Skip to content

Commit

Permalink
Verify candidate has running wal_receiver before targetting as primary
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Schultz-Falk <[email protected]>
  • Loading branch information
sjuls authored and gbartolini committed Dec 10, 2023
1 parent 485f65c commit fbcc811
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/replicas.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fbcc811

Please sign in to comment.