From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Portability issues in shm_mq |
Date: | 2014-03-17 17:26:26 |
Message-ID: | CA+TgmoZ1SOEbsfExgRcoh9H8P4w=tOH3_N-+-vxUo-+nngBn_Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Mar 17, 2014 at 12:03 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Sun, Mar 16, 2014 at 10:45 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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)".
Oh, yeah. Duh. Clearly my brain isn't working today. Hmm, so maybe
this will be fairly simple... will try it out.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-03-17 17:28:21 | Re: Planner hints in Postgresql |
Previous Message | Tom Lane | 2014-03-17 17:24:21 | Re: Planner hints in Postgresql |