Skip to content

Fix WAL validation for multi-timeline recovery targets#4

Merged
vbp1 merged 1 commit intomasterfrom
fix-validate-multi-timeline
Dec 25, 2025
Merged

Fix WAL validation for multi-timeline recovery targets#4
vbp1 merged 1 commit intomasterfrom
fix-validate-multi-timeline

Conversation

@vbp1
Copy link
Copy Markdown
Owner

@vbp1 vbp1 commented Dec 13, 2025

Summary

When validating a backup with --recovery-target-timeline different from the backup's timeline, pg_probackup incorrectly searched for WAL segments on the target timeline instead of the backup's timeline.

Changes

C code:

  • validate_backup_wal_from_start_to_stop now always uses backup->tli for checking backup consistency
  • Added multi-timeline support in validate_wal
  • Pass target_tli to validate_wal when specified

Test:

  • Remove @unittest.expectedFailure from test_validate_target_lsn
  • Fix test bugs (set_archiving, switch_wal_segment on correct node)

Test plan

  • test_validate_target_lsn passes
  • Other validate tests still pass

When validating a backup with --recovery-target-timeline different from
the backup's timeline, pg_probackup incorrectly searched for WAL segments
on the target timeline instead of the backup's timeline.

Changes in C code:
- validate_backup_wal_from_start_to_stop now always uses backup->tli
  for checking backup consistency (WAL from start_lsn to stop_lsn)
- Added multi-timeline support in validate_wal: when target timeline
  differs from backup timeline, validation is performed in two phases:
  1. From stop_lsn to switchpoint on backup's timeline
  2. From switchpoint to target_lsn on target timeline
- Pass target_tli to validate_wal in restore.c when specified

Test fixes:
- Remove @unittest.expectedFailure from test_validate_target_lsn
- Add set_archiving for restored node to archive timeline 2 WAL
- Fix switch_wal_segment call to use node_restored instead of node
@vbp1 vbp1 force-pushed the fix-validate-multi-timeline branch from 5437b33 to 06108fd Compare December 25, 2025 17:20
@vbp1 vbp1 merged commit d4212ce into master Dec 25, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant