From efaa785cfedb88e8fe859b52a23d87a8fddab190 Mon Sep 17 00:00:00 2001 From: Gabriele Bartolini Date: Tue, 22 Sep 2026 11:14:23 +0200 Subject: [PATCH 1/2] fix: log transient connectivity errors during WAL restore Requires Barman 3.20.0 Closes #1111 Signed-off-by: Gabriele Bartolini --- internal/cnpgi/common/wal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/cnpgi/common/wal.go b/internal/cnpgi/common/wal.go index 537fa34e..2b12b02d 100644 --- a/internal/cnpgi/common/wal.go +++ b/internal/cnpgi/common/wal.go @@ -408,6 +408,11 @@ func (w WALServiceImplementation) restoreFromBarmanObjectStore( // is the one that PostgreSQL has requested to restore. // The failure has already been logged in walRestorer.RestoreList method if walStatus[0].Err != nil { + if errors.Is(walStatus[0].Err, barmanRestorer.ErrConnectivity) { + // Only available from Barman 3.20.0 + contextLogger.Info("transient connectivity issue while restoring WAL, will retry", + "walName", walStatus[0].WalName, "error", walStatus[0].Err) + } return classifyWALRestoreError(walStatus[0].WalName, walStatus[0].Err) } From 378efe45d6f5bc29ae73e2e7f3d937c48baac204 Mon Sep 17 00:00:00 2001 From: Armando Ruocco Date: Thu, 24 Sep 2026 11:08:25 +0200 Subject: [PATCH 2/2] docs: align WAL restore comments with the connectivity log The comment above the first-WAL error check still said the failure is only logged by RestoreList, and the version note implied exit code 2 is new in Barman 3.20.0, while what changed there is that transient network errors are now reported with that exit code. Signed-off-by: Armando Ruocco --- internal/cnpgi/common/wal.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/cnpgi/common/wal.go b/internal/cnpgi/common/wal.go index 2b12b02d..4efc6738 100644 --- a/internal/cnpgi/common/wal.go +++ b/internal/cnpgi/common/wal.go @@ -406,10 +406,12 @@ func (w WALServiceImplementation) restoreFromBarmanObjectStore( // We return immediately if the first WAL has errors, because the first WAL // is the one that PostgreSQL has requested to restore. - // The failure has already been logged in walRestorer.RestoreList method + // The failure has already been logged in walRestorer.RestoreList method, + // connectivity failures get an extra line stating they are transient. if walStatus[0].Err != nil { if errors.Is(walStatus[0].Err, barmanRestorer.ErrConnectivity) { - // Only available from Barman 3.20.0 + // Barman reports transient network errors with exit code 2 + // starting from 3.20.0 contextLogger.Info("transient connectivity issue while restoring WAL, will retry", "walName", walStatus[0].WalName, "error", walStatus[0].Err) }