Search code examples
postgresqlpostgresql-12

pg_rewind: source and target cluster are on the same timeline


I tried to synchronize between source/target clusters by using pg_rewind by the following command. And I know 100% the content of in the source/target clusters are not the same anymore.

/usr/pgsql-12/bin/pg_rewind --source-server="192.168.100.100 user=postgres password=mypassword"  -D /var/lib/pgsql/12/data --progress

but pg_rewind gives the following message

pg_rewind: source and target cluster are on the same timeline
pg_rewind: no rewind required

I didn't understand how the content of pg_wal & base directories are different between source/target but pg_rewind did't realize that !!


Solution

  • pg_rewind only undoes data modifications on the target server later than the latest common checkpoint.

    Modifications that have happened on the source server after the latest common checkpoint are ignored – these will be recovered anyway when the target server becomes a standby of the source server.

    So the target server probably was shut down cleanly before the source server got promoted.

    The message about the timeline is coincidental, it is not the cause of the second message.