mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 16:48:27 -05:00
Cluster: use the node blacklist in CLUSTER FORGET.
CLUSTER FORGET is not useful if we can't remove a node from all the nodes of our cluster because of the Gossip protocol that keeps adding a given node to nodes where we already tried to remove it. So now CLUSTER FORGET implements a nodes blacklist that is set and checked by the Gossip section processing function. This way before a node is re-added at least 60 seconds must elapse since the FORGET execution. This means that redis-trib has some time to remove a node from a whole cluster. It is possible that in the future it will be uesful to raise the 60 sec figure to something bigger.
This commit is contained in:
parent
ccf268fa17
commit
3e948970fe
@ -967,9 +967,13 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
|
|||||||
* Note that we require that the sender of this gossip message
|
* Note that we require that the sender of this gossip message
|
||||||
* is a well known node in our cluster, otherwise we risk
|
* is a well known node in our cluster, otherwise we risk
|
||||||
* joining another cluster. */
|
* joining another cluster. */
|
||||||
if (sender && !(flags & REDIS_NODE_NOADDR))
|
if (sender &&
|
||||||
|
!(flags & REDIS_NODE_NOADDR) &&
|
||||||
|
!clusterBlacklistExists(g->nodename))
|
||||||
|
{
|
||||||
clusterStartHandshake(g->ip,ntohs(g->port));
|
clusterStartHandshake(g->ip,ntohs(g->port));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Next node */
|
/* Next node */
|
||||||
g++;
|
g++;
|
||||||
@ -2875,6 +2879,7 @@ void clusterCommand(redisClient *c) {
|
|||||||
addReplyErrorFormat(c,"Unknown node %s", (char*)c->argv[2]->ptr);
|
addReplyErrorFormat(c,"Unknown node %s", (char*)c->argv[2]->ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
clusterBlacklistAddNode(n);
|
||||||
clusterDelNode(n);
|
clusterDelNode(n);
|
||||||
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
|
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
|
Loading…
Reference in New Issue
Block a user