Re: [HACKERS] Function to move the position of a replication slot - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: [HACKERS] Function to move the position of a replication slot
Date
Msg-id CAMsr+YEp9GeCrxECcZ67CCSELTudAPSh3DMCVqo9JNeQ4hS3eA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Function to move the position of a replication slot  (Magnus Hagander <magnus@hagander.net>)
Responses Re: [HACKERS] Function to move the position of a replication slot  (Dmitry Dolgov <9erthalion6@gmail.com>)
List pgsql-hackers
On 4 May 2017 at 20:45, Magnus Hagander <magnus@hagander.net> wrote:
> On Thu, May 4, 2017 at 2:42 PM, Craig Ringer <craig@2ndquadrant.com> wrote:
>>
>> On 4 May 2017 at 20:05, Magnus Hagander <magnus@hagander.net> wrote:
>> > PFA a patch that adds a new function, pg_move_replication_slot, that
>> > makes
>> > it possible to move the location of a replication slot without actually
>> > consuming all the WAL on it.
>>
>> > This can be useful for example to keep replication slots in sync between
>> > different servers in a replication cluster.
>>
>> It needs a test to ensure it only operates on physical slots. It
>> should ERROR on a logical slot, since it has no way of correctly
>> advancing the catalog_xmin or finding a reasonable restart_lsn  for
>> logical decoding.
>
>
> I guess that makes sense, yeah. I didn't try it with that :)

Barring that and matching docs changes, looks fine to me at first glance.

Not sure you need to acquire the spinlock on the slot, since you
acquired the slot for your backend. It won't hurt, but I don't think
it's necessary.

I'm not convinced you need a WARNING for moving the slot backwards. If
one is emitted, it should be a proper ereport with current position
and requested position in errdetail. I'm not sure it's a useful
message though.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: [HACKERS] Function to move the position of a replication slot
Next
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] Reducing runtime of stats regression test