pg_rewind --source-server uses the libpq default mechanisms for the
database, but that's useless for pg_rewind, which can just always use
dbname=postgres, like other database-agnostic utilities.

pg_rewind requires that the target server be shut down cleanly, but does
not accept shutdown in recovery.  Is that necessary?

I have been trying to come with a kind of typical workflow for this
tool, which goes something like this:

- have a target server that I'd like to reattach to a new source server
- write recovery.conf file
- start target server; sometimes this works without pg_rewind -> happy
- otherwise run pg_rewind, which fails because of shutdown in recovery
- remove recovery.conf, start server, stop server
- run pg_rewind again
- put back recovery.conf
- start server

If I patch pg_rewind to allow shutdown in recovery, it goes slightly
easier, but it will delete my recovery.conf file and instead copy over
the recovery.done file from the other guy, which can lead to some confusion.

Could we change this to:

- not delete recovery.conf
- not copy recovery.done


Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to