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
| 993 | * it is a slave node. |
| 994 | */ |
| 995 | void 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 */ |
| 1025 | clusterNode *clusterLookupNode(const char *name) { |
no test coverage detected