Repair disconnected cluster with one shard #1618
Open
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.
Description
This PR implements automatic recovery for single-shard Redis Cluster instances when master and slave nodes restart simultaneously and lose track of each other's IP addresses. When both nodes of a single-shard cluster restart, they retain stale IP addresses in their nodes.conf files and fail to reconnect automatically. This fix detects such scenarios and executes a CLUSTER MEET command to reintroduce the follower node to the leader using the current IP address.
The solution adds a new recovery path in the reconciliation loop that specifically handles single-shard clusters (leaderReplicas == 1 && followerReplicas == 1) with unhealthy nodes. It introduces the RepairDisconnectedCluster function that retrieves the current follower pod IP from Kubernetes and issues a CLUSTER MEET command from the leader to re-establish the cluster connection.
Type of change
Bug fix (non-breaking change which fixes an issue)
Additional Context
E2E tests added for both Redis v6 and v7 to validate the repair mechanism
No functional behavior changes for clusters with more than one shard