fix(failover): heal on a running quorum instead of requiring all pods - #37
Merged
Conversation
CheckAndHeal returned early unless every redis and sentinel pod was Running, so a single pod stuck Pending (unschedulable affinity, availability zone loss) blocked master election and sentinel reconfiguration for the survivors, leaving the cluster unable to recover. Gate on a quorum (majority) of pods running instead. The downstream heal logic already operates only on the running/reachable pods and the force-election stays guarded by the sentinel quorum check, so only the early-return gate changes. Bootstrap mode still waits for the full set. Refs upstream spotahome#535, spotahome#552, spotahome#601.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Relaxes the
CheckAndHealgate: the operator now proceeds to heal when a quorum (majority) of redis and sentinel pods are Running, instead of requiring the full set.Why
CheckAndHealreturned early unless every redis and sentinel pod was Running. A single pod stuck Pending — unschedulable anti-affinity, an availability-zone loss taking a node down — blocked all healing: no master election, no sentinel monitor reconfiguration. The cluster could not recover on its own.127.0.0.1monitor and is never reconfigured to the new master.Why it's safe
The downstream heal path already operates only on running/reachable pods (
GetRedisesIPsfilters toPodRunning;SetMasterOnAll/CheckAllSlavesFromMasterskip unreachable pods), and the operator's force-election stays guarded byCheckSentinelQuorum+CheckIfMasterLocalhost. So only the early-return gate needed to change — no downstream behaviour changes.replicas/2 + 1(2-of-3 proceeds; 1-of-3 still waits, so a mostly-down cluster is not auto-healed).Changes
check.go:AreQuorumRunninghelper +IsRedisRunningQuorum/IsSentinelRunningQuorumpredicates (interface + mock).checker.go: theCheckAndHealgate uses the quorum predicates.AreQuorumRunningtable test; existingCheckAndHealgate test routed to the quorum predicates.Upstream references
Test
go build ./...,go test ./...,gofmtclean.