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

Function clusterManagerGetLinkStatus

app/redis-6.2.6/src/redis-cli.c:4521–4554  ·  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

4519 * are the unreachable node addresses and the values are lists of
4520 * node addresses that cannot reach the unreachable node. */
4521static dict *clusterManagerGetLinkStatus(void) {
4522 if (cluster_manager.nodes == NULL) return NULL;
4523 dict *status = dictCreate(&clusterManagerLinkDictType, NULL);
4524 listIter li;
4525 listNode *ln;
4526 listRewind(cluster_manager.nodes, &li);
4527 while ((ln = listNext(&li)) != NULL) {
4528 clusterManagerNode *node = ln->value;
4529 list *links = clusterManagerGetDisconnectedLinks(node);
4530 if (links) {
4531 listIter lli;
4532 listNode *lln;
4533 listRewind(links, &lli);
4534 while ((lln = listNext(&lli)) != NULL) {
4535 clusterManagerLink *link = lln->value;
4536 list *from = NULL;
4537 dictEntry *entry = dictFind(status, link->node_addr);
4538 if (entry) from = dictGetVal(entry);
4539 else {
4540 from = listCreate();
4541 dictAdd(status, sdsdup(link->node_addr), from);
4542 }
4543 sds myaddr = sdsempty();
4544 myaddr = sdscatfmt(myaddr, "%s:%u", node->ip, node->port);
4545 listAddNodeTail(from, myaddr);
4546 sdsfree(link->node_name);
4547 sdsfree(link->node_addr);
4548 zfree(link);
4549 }
4550 listRelease(links);
4551 }
4552 }
4553 return status;
4554}
4555
4556/* Add the error string to cluster_manager.errors and print it. */
4557static void clusterManagerOnError(sds err) {

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
listReleaseFunction · 0.85
dictCreateFunction · 0.70
dictFindFunction · 0.70

Tested by

no test coverage detected