Re: PATCH: Add 'pid' column to pg_replication_slots

From: Andres Freund <andres(at)anarazel(dot)de>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Add 'pid' column to pg_replication_slots
Date: 2015-04-21 10:23:09
Message-ID: 4A878F16-A067-4176-8BF7-70286B3560D3@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On April 21, 2015 1:17:32 PM GMT+03:00, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
>On 21 April 2015 at 15:19, Andres Freund <andres(at)anarazel(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-04-21 10:55:41 Re: Streaming replication and WAL archive interactions
Previous Message Craig Ringer 2015-04-21 10:17:32 Re: PATCH: Add 'pid' column to pg_replication_slots