On April 21, 2015 1:17:32 PM GMT+03:00, Craig Ringer <craig@2ndquadrant.com> wrote:
>On 21 April 2015 at 15:19, Andres Freund <andres@anarazel.de> wrote:
>
>> On 2015-04-07 18:41:59 +0800, Craig Ringer wrote:
>> > @@ -331,8 +331,8 @@ ReplicationSlotAcquire(const char *name)
>> > volatile ReplicationSlot *vslot = s;
>> >
>> > SpinLockAcquire(&s->mutex);
>> > - active = vslot->active;
>> > - vslot->active = true;
>> > + active = vslot->active_pid != 0;
>> > + vslot->active_pid = MyProcPid;
>> > SpinLockRelease(&s->mutex);
>> > slot = s;
>> > break;
>>
>> Uh. You're overwriting the existing pid here. Not good if the slot is
>> currently in use.
>>
>
>Isn't that the point? We're acquiring the slot there, per the comment:
Read the rest of the function. We're checking for conflicts...
---
Please excuse brevity and formatting - I am writing this on my mobile phone.