Re: Few observations in replication slots related code - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Few observations in replication slots related code
Date
Msg-id CAA4eK1+jAyB0RFLzvkro-+WwE8xQ0K6tXxCs0Nv3AYjYRtR0UA@mail.gmail.com
Whole thread Raw
In response to Re: Few observations in replication slots related code  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Few observations in replication slots related code  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Thu, Jun 12, 2014 at 12:45 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> On 2014-06-12 08:55:59 +0530, Amit Kapila wrote:
> > Function pg_create_logical_replication_slot() is trying to
> > save slot twice once during CreateInitDecodingContext() and
> > then in ReplicationSlotPersist(), isn't it better if we can make
> > it do it just once?
>
> Doesn't work here. In the first save it's not yet marked as persistent -
> but we still need to safely reserve the xmin.

Okay, but if it crashes before saving the persistency to permanent
file and there remains a .tmp for this replication slot which it created
during save of this persistency information, then also xmin will get
lost, because during startup it will not consider such a slot.

> It's also not something
> that should happen very frequently, so I'm not worried about the
> overhead.

Right, just looking from the purpose of need for same.

> > 8. Is there a chance of inconsistency, if pg_restxlog resets the
> > xlog and after restart, one of the slots contains xlog position
> > older than what is resetted by pg_resetxlog?
>
> Yes. There's lots of ways to screw over your database by using
> pg_resetxlog.

Thats right, trying to think if there could be any thing which
won't even allow the server to get started due to replication slots
after pg_resetxlog.  As per my current understanding, I don't think
there is any such problem.


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Abhijit Menon-Sen
Date:
Subject: Re: pg_xlogdump --stats
Next
From: Pavel Stehule
Date:
Subject: Re: PL/pgSQL support to define multi variables once