You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pg_rewind: ignore shutdown-only WAL when determining end-of-WAL
Previously, pg_rewind determined the end-of-WAL on the target by using
the last shutdown checkpoint (or minRecoveryPoint for a standby). This
caused false positives in scenarios where the old primary was shut down
after a failover: the only WAL record generated was a shutdown checkpoint,
while the new primary and old primary still contained identical data.
In such cases, pg_rewind incorrectly concluded that
if (target_wal_endrec > divergerec) rewind_needed = true;
and performed a rewind even though no real changes existed after the
divergence point.
With this patch, pg_rewind now scans backward from the last checkpoint
to locate the most recent valid WAL record that is not a shutdown
checkpoint or XLOG switch. As a result, a rewind is only required when
the target contains actual changes past the divergence point, avoiding
unnecessary rewind operations in clean failover scenarios.
0 commit comments