mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Cluster: don't let a node forget its own master.
redis-trib should make sure to reconfigure slaves of a node to remove from the cluster to replicate with other nodes before sending CLUSTER FORGET.
This commit is contained in:
parent
9531c84807
commit
3d455393a6
@ -2875,12 +2875,16 @@ void clusterCommand(redisClient *c) {
|
||||
/* CLUSTER FORGET <NODE ID> */
|
||||
clusterNode *n = clusterLookupNode(c->argv[2]->ptr);
|
||||
|
||||
if (n == server.cluster->myself) {
|
||||
addReplyErrorFormat(c,"I tried hard but I can't forget myself...");
|
||||
return;
|
||||
} else if (!n) {
|
||||
if (!n) {
|
||||
addReplyErrorFormat(c,"Unknown node %s", (char*)c->argv[2]->ptr);
|
||||
return;
|
||||
} else if (n == server.cluster->myself) {
|
||||
addReplyError(c,"I tried hard but I can't forget myself...");
|
||||
return;
|
||||
} else if (server.cluster->myself->flags & REDIS_NODE_SLAVE &&
|
||||
server.cluster->myself->slaveof == n) {
|
||||
addReplyError(c,"Can't forget my master!");
|
||||
return;
|
||||
}
|
||||
clusterBlacklistAddNode(n);
|
||||
clusterDelNode(n);
|
||||
|
Loading…
Reference in New Issue
Block a user