Open PingXie opened 2 years ago
@madolson I am planning to repurpose this issue and add the failed node tracking logic to the new CLUSTER SHARDS
command (#10293). I would like to clarify with you on the high level requirements before resurrecting the PR.
CLUSTER SHARDS
response;CLUSTER SHARDS
response. Is this acceptable?failed
flag to the CLUSTER NODES
output. This was considered an app-compat risk by @zuiderkwast and it is the reason why I abandoned the original fix.
The problem/use-case that the feature addresses
Today when running an HA Redis cluster, if the machine on which a primary was running is permanently down, the Redis cluster automatically fails over the primary-ship to a replica. This is all good. Now one way to bring the redundancy level back is to start a Redis server on a new and healthy machine and then add it as a replica to the impacted shard. The problem here is that there is no easy way to quickly determine from which primary the new Redis server instance should replicate. We can see from "CLUSTER NODES" the old/down primary but there are no slot ranges associated with it. We could manually count the number of live replicas in each shard and then infer from there that one of the shards is short of replicas. This however can get tedious and error prone when there are many shards in the cluster.
Description of the feature
The ask here is to retain the down primary's slot info in a "back pocket" in the clusterNode structure such that this slot info is not lost after an automatic fail-over. This information can then be used to identify the new primary owner. Here is an example:
72f66f4ecbcfc3055faae01a68bbeadc5079bb92 127.0.0.1:30001@40001 master,fail - 1642667704665 1642667703661 1 disconnected 0-5460
Alternatives you've considered
Manually count number of replicas in each shard and figure out their zonal location.
Additional information
Note that in the non-HA case, this slot info is retained since there is no automatic fail over. The proposed change helps close the inconsistency between HA and non-HA cases.
I have a private change ready to be submitted.