Re: Portability issues in shm_mq

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Portability issues in shm_mq
Дата
Msg-id 17909.1395072230@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Portability issues in shm_mq  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Portability issues in shm_mq  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Sun, Mar 16, 2014 at 10:45 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Well, it will result in padding space when you maxalign the length word,
>> but I don't see why it wouldn't work; and it would certainly be no less
>> efficient than what's there today.

> Well, the problem is with this:

>     /* Write the message length into the buffer. */
>     if (!mqh->mqh_did_length_word)
>     {
>         res = shm_mq_send_bytes(mqh, sizeof(uint64), &nbytes, nowait,
>                                 &bytes_written);

> If I change nbytes to be of type Size, and the second argument to
> sizeof(Size), then it's wrong whenever sizeof(Size) % MAXIMUM_ALIGNOF
> != 0.

Well, you need to maxalign the number of bytes physically inserted into
the queue.  Doesn't shm_mq_send_bytes do that?  Where do you do the
maxaligning of the message payload data, when the payload is odd-length?
I would have expected some logic like "copy N bytes but then advance
the pointer by maxalign(N)".
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Portability issues in shm_mq
Следующее
От: David Johnston
Дата:
Сообщение: Re: Planner hints in Postgresql