mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Cluster: set the slaves->slaveof filed to NULL when master is freed.
Related to issue #2289.
This commit is contained in:
parent
491d57abaa
commit
59ad6ac5fe
@ -821,6 +821,14 @@ int clusterCountNonFailingSlaves(clusterNode *n) {
|
|||||||
|
|
||||||
void freeClusterNode(clusterNode *n) {
|
void freeClusterNode(clusterNode *n) {
|
||||||
sds nodename;
|
sds nodename;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
/* If the node is a master with associated slaves, we have to set
|
||||||
|
* all the slaves->slaveof fields to NULL (unknown). */
|
||||||
|
if (nodeIsMaster(n)) {
|
||||||
|
for (j = 0; j < n->numslaves; j++)
|
||||||
|
n->slaves[j]->slaveof = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
nodename = sdsnewlen(n->name, REDIS_CLUSTER_NAMELEN);
|
nodename = sdsnewlen(n->name, REDIS_CLUSTER_NAMELEN);
|
||||||
redisAssert(dictDelete(server.cluster->nodes,nodename) == DICT_OK);
|
redisAssert(dictDelete(server.cluster->nodes,nodename) == DICT_OK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user