Fix backup manifests to generate correct WAL-Ranges across timelines
authorMichael Paquier <michael@paquier.xyz>
Mon, 23 Aug 2021 02:09:33 +0000 (11:09 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 23 Aug 2021 02:09:33 +0000 (11:09 +0900)
commita3fcbcda7505e9079cec95e7209cde4f5d5c8bd8
treef4015c672d1d0a87a7c454bc4e8c15197b3b4247
parentc818c25f448d0085e1bb2be402463a4b28bc20c4
Fix backup manifests to generate correct WAL-Ranges across timelines

In a backup manifest, WAL-Ranges stores the range of WAL that is
required for the backup to be valid.  pg_verifybackup would then
internally use pg_waldump for the checks based on this data.

When the timeline where the backup started was more than 1 with a
history file looked at for the manifest data generation, the calculation
of the WAL range for the first timeline to check was incorrect.  The
previous logic used as start LSN the start position of the first
timeline, but it needs to use the start LSN of the backup.  This would
cause failures with pg_verifybackup, or any tools making use of the
backup manifests.

This commit adds a test based on a logic using a self-promoted node,
making it rather cheap.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20210818.143031.1867083699202617521.horikyota.ntt@gmail.com
Backpatch-through: 13
src/backend/replication/backup_manifest.c
src/bin/pg_verifybackup/t/007_wal.pl