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. */
| 544 | * are the unreachable node addresses and the values are lists of |
| 545 | * node addresses that cannot reach the unreachable node. */ |
| 546 | dict *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 | |
| 581 | extern "C" int clusterManagerCheckCluster(int quiet) { |
| 582 | listNode *ln = listFirst(cluster_manager.nodes); |
no test coverage detected