plugin-barman-cloud/internal/cnpgi/restore
Vaibhav Bhembre f41c034877 fix: pass --timeline to barman-cloud-check-wal-archive after failover
After a failover/promotion, WAL archiving permanently breaks because
barman-cloud-check-wal-archive rejects the archive with "Expected
empty archive" -- it finds WAL from the previous timeline and treats
it as an error.

Detect the server's current timeline from pg_controldata (reliable
because PostgreSQL's end-of-recovery checkpoint updates the control
file before the archiver starts) and pass it via --timeline to the
check command. WAL from earlier timelines is then accepted as
expected, while WAL from the current timeline in the archive still
correctly triggers the safety check.

Timeline detection is scoped strictly inside the one-time
empty-archive check gate (.check-empty-wal-archive flag file).
Steady-state WAL archiving is completely unaffected.

During restore/bootstrap, timeline 0 is passed so the check remains
strict (archive must be empty).

Fixes: #842
Related: #828

Assisted-by: Claude Opus 4.6
Assisted-by: GPT-5.4 in Cursor
Signed-off-by: Vaibhav Bhembre <vbhembre@coreweave.com>
2026-04-13 16:46:20 +02:00
..
doc.go feat(ip): assign copyright to the Linux Foundation (#571) 2025-10-07 18:06:06 +02:00
identity.go feat(ip): assign copyright to the Linux Foundation (#571) 2025-10-07 18:06:06 +02:00
manager.go fix(restore): use custom CNPG group and version for scheme registration (#847) 2026-04-13 13:20:38 +02:00
restore.go fix: pass --timeline to barman-cloud-check-wal-archive after failover 2026-04-13 16:46:20 +02:00
start.go feat(ip): assign copyright to the Linux Foundation (#571) 2025-10-07 18:06:06 +02:00