fix: RepairDisconnectedMasters does not heal failed followers, causing infinite Failed state after pod restarts#1705
Open
svils wants to merge 2 commits intoOT-CONTAINER-KIT:mainfrom
Open
Conversation
340b07d to
d57ffa9
Compare
…g infinite Failed state after pod restarts Broaden repairDisconnectedMasters to handle both failed masters and failed slaves (renamed to RepairDisconnectedNodes). For slaves, issue CLUSTER MEET to fix gossip and CLUSTER REPLICATE to re-establish replication so the follower resolves its master's current IP. Add RepairStaleReplication to detect connected followers whose master_link_status is down and re-issue CLUSTER REPLICATE. Harden cluster config defaults: - tcp-keepalive 60s (faster dead connection detection) - cluster-node-timeout 15000ms (more gossip recovery time, configurable) - cluster-allow-reads-when-down yes (unblock clients during repair) - probe TimeoutSeconds=5 / FailureThreshold=5 (prevent premature pod eviction) Fixes OT-CONTAINER-KIT#1692 Signed-off-by: svils <63684363+svils@users.noreply.github.com>
d57ffa9 to
11722dd
Compare
Author
|
@shubham-cmyk hey, you asked me to open this PR back on #1692 — it's been about a month now with no review. we're running this in production across multiple EKS clusters and keep hitting these bugs on every node rotation. this PR (#1705) fixes the follower repair loop, but while debugging in prod i ran into two more issues that are closely related:
all three are straightforward fixes with tests, and they've been running stable in our production builds. would be great to get some eyes on these so they can land in the next release. |
|
@shubham-cmyk @drivebyer can you please review and get this fix in ? We're facing this issue on few environmnets and it would be really helpful to have this fixed. |
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.
Summary
Fixes #1692
repairDisconnectedMasters→RepairDisconnectedNodesto handle both failed masters and failed slaves. For slaves, issueCLUSTER MEET(fix gossip) +CLUSTER REPLICATE(re-establish replication so the follower resolves its master's current IP from gossip).RepairStaleReplicationto detect connected followers whosemaster_link_statusisdownand re-issueCLUSTER REPLICATE. This catches the subtler case where gossip is fine but replication is still pointed at a stale IP.tcp-keepalive60s (Redis recommends this; faster dead connection detection)cluster-node-timeout15000ms, configurable viaCLUSTER_NODE_TIMEOUTenv var (more gossip recovery time before marking nodes failed)cluster-allow-reads-when-down yes(keep clients unblocked while the operator repairs nodes)TimeoutSeconds=5/FailureThreshold=5(prevent Kubernetes from prematurely evicting pods during transient blips)Both
CLUSTER MEETandCLUSTER REPLICATEare idempotent and safe to retry.Test plan
RepairDisconnectedMasters→RepairDisconnectedNodes)replicationLinkUp(up, down, master node, empty)RepairStaleReplication(replication down → repaired, replication up → no-op)statefulset_test.goexpectations for new probe defaultsgo test ./internal/k8sutils/...)