Re: pg_rewind vs superuser - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_rewind vs superuser
Date
Msg-id 20190405110529.GB1491@paquier.xyz
Whole thread Raw
In response to Re: pg_rewind vs superuser  (Michael Banck <mbanck@gmx.net>)
Responses Re: pg_rewind vs superuser  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
On Fri, Apr 05, 2019 at 10:39:26AM +0200, Michael Banck wrote:
> Ok, so the problem is that that checkpoint might be still ongoing when
> you quickly issue a pg_rewind from the other side?

The end-of-recovery checkpoint may not have even begun.

> I think it might be useful to specify more exactly which of the two
> servers (the remote one AIUI) needs a CHECKPOINT in the above. Also, if
> it is the case that a CHECKPOINT is done automatically (see above), that
> paragraph could be rewritten to say something like "pg_rewind needs to
> wait for the checkoint on the remote server to finish. This can be
> ensured by issueing an explicit checkpoint on the remote server prior to
> running pg_rewind."

Well, the target server needs to be cleanly shut down, so it seems
pretty clear to me which one needs to have a checkpoint :)

> Finally, (and still, if I got the above correctly), to the suggestion of
> Magnus of pg_rewind running the checkpoint itself on the remote: would
> that again mean that pg_rewind needs SUPERUSER rights or is there
> a(nother) GRANTable function that could be added to the list in this
> case?

pg_rewind would require again a superuser.  So this could be
optional.  In one HA workflow I maintain, what I actually do is to
enforce directly a checkpoint immediately after the promotion is done
to make sure that the data is up-to-date, and I don't meddle with
pg_rewind workflow.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_rewind vs superuser
Next
From: Peter Eisentraut
Date:
Subject: Re: log bind parameter values on error