postgresql/src/bin
Michael Paquier 5173bfd044 pg_rewind: Skip copy of WAL segments generated before point of divergence
This commit makes the way WAL segments are handled from the source to
the target server slightly smarter: the copy of the WAL segments is now
skipped if these have been created before the point where source and
target have diverged (the WAL segment where the point of divergence
exists is still copied), because we know that such segments exist on
both the target and source.  Note that the on-disk size of the WAL
segments on the source and target need to match.  Hence, only the
segments generated after the point of divergence are now copied.  A
segment existing on the source but not the target is copied.

Previously, all the WAL segments were just copied in full.  This change
can make the rewind operation cheaper in some configurations, especially
for setups where some WAL retention causes many segments to remain on
the source server even after the promotion of a standby used as source
to rewind a previous primary.

A TAP test is added to track these new behaviors.  The file map printed
with --debug now includes all the information related to WAL segments,
to be able to track if these are copied or skipped, and the test relies
on the debug output generated.

Author: John Hsu <johnhyvr@gmail.com>
Author: Justin Kwan <justinpkwan@outlook.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://postgr.es/m/181b4c6fa9c.b8b725681941212.7547232617810891479@viggy28.dev
2025-10-25 09:07:31 +09:00
..
initdb Improve TAP tests by replacing ok() with better Test::More functions 2025-10-17 14:39:09 +09:00
pg_amcheck amcheck: Improve confusing message 2025-07-01 12:24:17 +02:00
pg_archivecleanup Translation updates 2025-05-05 12:04:49 +02:00
pg_basebackup Improve TAP tests by replacing ok() with better Test::More functions 2025-10-17 14:39:09 +09:00
pg_checksums pg_checksums: Use new routine to retrieve data of PG_VERSION 2025-10-20 09:35:22 +09:00
pg_combinebackup Fix memory leaks in pg_combinebackup/reconstruct.c. 2025-10-22 13:38:40 -04:00
pg_config Translation updates 2025-05-05 12:04:49 +02:00
pg_controldata Standardize LSN formatting by zero padding 2025-07-07 13:57:43 +02:00
pg_ctl Translation updates 2025-05-05 12:04:49 +02:00
pg_dump Avoid short seeks in pg_restore. 2025-10-21 14:10:14 -04:00
pg_resetwal pg_resetwal: Use new routine to retrieve data of PG_VERSION 2025-10-15 10:09:48 +09:00
pg_rewind pg_rewind: Skip copy of WAL segments generated before point of divergence 2025-10-25 09:07:31 +09:00
pg_test_fsync Translation updates 2025-05-05 12:04:49 +02:00
pg_test_timing Include pg_test_timing's full output in the TAP test log. 2025-09-24 12:09:11 -04:00
pg_upgrade pg_upgrade: Use new routine to retrieve data of PG_VERSION 2025-10-14 16:27:13 +09:00
pg_verifybackup Standardize LSN formatting by zero padding 2025-07-07 13:57:43 +02:00
pg_waldump Standardize LSN formatting by zero padding 2025-07-07 13:57:43 +02:00
pg_walsummary pg_walsummary: Improve stability of test checking statistics 2025-07-08 13:48:49 +09:00
pgbench Improve TAP tests by replacing ok() with better Test::More functions 2025-10-17 14:39:09 +09:00
pgevent Update copyright for 2025 2025-01-01 11:21:55 -05:00
psql psql: Improve tab completion for large objects. 2025-10-24 14:31:14 +09:00
scripts Fix memory leaks in scripts/vacuuming.c. 2025-10-22 15:19:19 -04:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00