From ba9fdef921f1f5b055457ad475446b93c7175e3e Mon Sep 17 00:00:00 2001 From: Jakob Schultz-Falk Date: Mon, 4 Dec 2023 15:28:33 +0100 Subject: [PATCH] Verify candidate has running wal_receiver before targetting as primary Signed-off-by: Jakob Schultz-Falk --- controllers/replicas.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/replicas.go b/controllers/replicas.go index 016d7ce043..72cecfb8f8 100644 --- a/controllers/replicas.go +++ b/controllers/replicas.go @@ -232,6 +232,11 @@ func (r *ClusterReconciler) setPrimaryOnSchedulableNode( continue } + // If the candidate has not established a connection to the current primary, skip it + if !candidate.IsWalReceiverActive { + continue + } + // Set the current candidate as targetPrimary contextLogger.Info("Current primary is running on unschedulable node, triggering a switchover", "currentPrimary", primaryPod.Pod.Name, "currentPrimaryNode", primaryPod.Node,