On 28/04/14 15:36, Robert Haas wrote:
> On Tue, Apr 22, 2014 at 9:55 AM, Petr Jelinek <petr@2ndquadrant.com> wrote:
>>
>> But if I do first receive after detach like in this sequence:
>> P1 -> set_sender
>> P1 -> attach
>> P2 -> set_receiver
>> P2 -> attach
>> P1 -> send
>> P1 -> send
>> P1 -> detach
>> P2 -> receive
>>
>> I get SHM_MQ_DETACHED on the receiver even though there are messages in the
>> ring buffer.
>
> That's a bug.
>
> I'm thinking that the problem is really revolves around
> shm_mq_wait_internal(). It returns true if the queue is attached but
> not detached, and false if either the detach has already happened, or
> if we establish via the background worker handle that it will never
> come. But in the case of receiving, we want to treat
> attached-then-detached as a success case, not a failure case.
>
> Can you see if the attached patch fixes it?
>
Yes, the patch fixes it for me.
-- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training &
Services