Skip to content

Comments

fix: handle empty CurrentPrimary in isStreamingAvailable#65

Open
ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
ermakov-oleg:fix/streaming-available-check
Open

fix: handle empty CurrentPrimary in isStreamingAvailable#65
ermakov-oleg wants to merge 1 commit intooperasoftware:mainfrom
ermakov-oleg:fix/streaming-available-check

Conversation

@ermakov-oleg
Copy link

Summary

Port of upstream #604

Problem: When a brand-new cluster is starting, cluster.Status.CurrentPrimary is an empty string until the first pod becomes primary. The isStreamingAvailable() function did not handle this case — it fell through to logic that assumed a non-empty primary name, potentially returning incorrect results and causing WAL archiving attempts before the cluster is ready.

Fix: Added an early return false when CurrentPrimary == "", explicitly handling the bootstrapping phase. Streaming replication cannot be available if no primary has been elected yet.

@ermakov-oleg ermakov-oleg force-pushed the fix/streaming-available-check branch from c8846cf to afbf18d Compare February 13, 2026 22:52
Port of upstream PR cloudnative-pg#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 <ermakovolegs@gmail.com>
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