fix: reset follower with stale state before add-node to prevent "Node is not empty" loop#1734
Open
svils wants to merge 1 commit intoOT-CONTAINER-KIT:mainfrom
Open
fix: reset follower with stale state before add-node to prevent "Node is not empty" loop#1734svils wants to merge 1 commit intoOT-CONTAINER-KIT:mainfrom
svils wants to merge 1 commit intoOT-CONTAINER-KIT:mainfrom
Conversation
… is not empty" loop ExecuteRedisReplicationCommand uses `redis-cli --cluster add-node` to join followers to the cluster. This command requires the target node to be completely empty — no cluster state and no keys in database 0. After a leader-only CLUSTER RESET during single-node bootstrap (via executeFailoverCommand), the follower retains its previous cluster state and replicated data. The operator then enters an infinite error loop: [ERR] Node <cluster>-follower-0...is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0. Add resetFollowerIfNotEmpty: before running add-node, check whether the follower knows other nodes or has keys in db0. If so, issue CLUSTER RESET HARD to clear both cluster state and data so add-node can succeed. The follower will re-sync from the master via full sync after joining. Related: OT-CONTAINER-KIT#1407 Signed-off-by: svils <63684363+svils@users.noreply.github.com>
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
redis-cli --cluster add-node, check if the follower has stale cluster state (knows other nodes) or data in db0CLUSTER RESET HARDto clear both, allowingadd-nodeto succeedAfter a leader-only
CLUSTER RESETduring single-node bootstrap, the follower retains its previous cluster state and replicated data.add-noderejects it with "Node is not empty", causing an infinite error loop on every reconcile cycle.Fixes #1733
Related: #1407
Test plan
resetFollowerIfNotEmptycovering: empty node (no-op), stale cluster state, keys in db0, error pathsk8sutilstest suite passesclusterSize: 1with 1 follower) — delete the leader PVC to trigger bootstrap, confirm follower is reset and re-added automatically