MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / clusterManagerGetLinkStatus

Function clusterManagerGetLinkStatus

src/redis-cli-cpphelper.cpp:546–579  ·  view source on GitHub ↗

Check for disconnected cluster links. It returns a dict whose keys * are the unreachable node addresses and the values are lists of * node addresses that cannot reach the unreachable node. */

Source from the content-addressed store, hash-verified

544 * are the unreachable node addresses and the values are lists of
545 * node addresses that cannot reach the unreachable node. */
546dict *clusterManagerGetLinkStatus(void) {
547 if (cluster_manager.nodes == NULL) return NULL;
548 dict *status = dictCreate(&clusterManagerLinkDictType, NULL);
549 listIter li;
550 listNode *ln;
551 listRewind(cluster_manager.nodes, &li);
552 while ((ln = listNext(&li)) != NULL) {
553 clusterManagerNode *node = (clusterManagerNode*)ln->value;
554 list *links = clusterManagerGetDisconnectedLinks(node);
555 if (links) {
556 listIter lli;
557 listNode *lln;
558 listRewind(links, &lli);
559 while ((lln = listNext(&lli)) != NULL) {
560 clusterManagerLink *link = (clusterManagerLink*)lln->value;
561 list *from = NULL;
562 dictEntry *entry = dictFind(status, link->node_addr);
563 if (entry) from = (list*)dictGetVal(entry);
564 else {
565 from = listCreate();
566 dictAdd(status, sdsdup(link->node_addr), from);
567 }
568 sds myaddr = sdsempty();
569 myaddr = sdscatfmt(myaddr, "%s:%u", node->ip, node->port);
570 listAddNodeTail(from, myaddr);
571 sdsfree(link->node_name);
572 sdsfree(link->node_addr);
573 zfree(link);
574 }
575 listRelease(links);
576 }
577 }
578 return status;
579}
580
581extern "C" int clusterManagerCheckCluster(int quiet) {
582 listNode *ln = listFirst(cluster_manager.nodes);

Callers 1

Calls 14

listRewindFunction · 0.85
listNextFunction · 0.85
listCreateFunction · 0.85
sdsdupFunction · 0.85
sdsemptyFunction · 0.85
sdscatfmtFunction · 0.85
listAddNodeTailFunction · 0.85
sdsfreeFunction · 0.85
zfreeFunction · 0.85
listReleaseFunction · 0.85
dictCreateFunction · 0.70

Tested by

no test coverage detected