MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterDelNode

Function clusterDelNode

app/redis-6.2.6/src/cluster.c:995–1022  ·  view source on GitHub ↗

Remove a node from the cluster. The function performs the high level * cleanup, calling freeClusterNode() for the low level cleanup. * Here we do the following: * * 1) Mark all the slots handled by it as unassigned. * 2) Remove all the failure reports sent by this node and referenced by * other nodes. * 3) Free the node with freeClusterNode() that will in turn remove it * from the ha

Source from the content-addressed store, hash-verified

993 * it is a slave node.
994 */
995void clusterDelNode(clusterNode *delnode) {
996 int j;
997 dictIterator *di;
998 dictEntry *de;
999
1000 /* 1) Mark slots as unassigned. */
1001 for (j = 0; j < CLUSTER_SLOTS; j++) {
1002 if (server.cluster->importing_slots_from[j] == delnode)
1003 server.cluster->importing_slots_from[j] = NULL;
1004 if (server.cluster->migrating_slots_to[j] == delnode)
1005 server.cluster->migrating_slots_to[j] = NULL;
1006 if (server.cluster->slots[j] == delnode)
1007 clusterDelSlot(j);
1008 }
1009
1010 /* 2) Remove failure reports. */
1011 di = dictGetSafeIterator(server.cluster->nodes);
1012 while((de = dictNext(di)) != NULL) {
1013 clusterNode *node = dictGetVal(de);
1014
1015 if (node == delnode) continue;
1016 clusterNodeDelFailureReport(node,delnode);
1017 }
1018 dictReleaseIterator(di);
1019
1020 /* 3) Free the node, unlinking it from the cluster. */
1021 freeClusterNode(delnode);
1022}
1023
1024/* Node lookup by name */
1025clusterNode *clusterLookupNode(const char *name) {

Callers 4

clusterResetFunction · 0.85
clusterProcessPacketFunction · 0.85
clusterCronFunction · 0.85
clusterCommandFunction · 0.85

Calls 6

clusterDelSlotFunction · 0.85
dictGetSafeIteratorFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70
freeClusterNodeFunction · 0.70

Tested by

no test coverage detected