From 49a622f75ca1f18daa310f43dd1af5c8f158fcc3 Mon Sep 17 00:00:00 2001 From: ermakov-oleg Date: Thu, 12 Feb 2026 15:56:28 +0100 Subject: [PATCH] fix: disable end-of-wal flag management during backup restoration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port of upstream PR #604. When CurrentPrimary is empty (first instance), streaming is not available — prevents incorrect WAL predictions with custom segment sizes during restore. Signed-off-by: ermakov-oleg --- 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 58fdf280..55ca055b 100644 --- a/internal/cnpgi/common/wal.go +++ b/internal/cnpgi/common/wal.go @@ -431,6 +431,11 @@ func isStreamingAvailable(cluster *cnpgv1.Cluster, podName string) bool { return false } + // First instance of a new cluster: streaming is not available yet + if cluster.Status.CurrentPrimary == "" { + return false + } + // Easy case: If this pod is a replica, the streaming is always available if cluster.Status.CurrentPrimary != podName { return true