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

Function clusterManagerIsConfigConsistent

app/redis-6.2.6/src/redis-cli.c:4447–4472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4445}
4446
4447static int clusterManagerIsConfigConsistent(void) {
4448 if (cluster_manager.nodes == NULL) return 0;
4449 int consistent = (listLength(cluster_manager.nodes) <= 1);
4450 // If the Cluster has only one node, it's always consistent
4451 if (consistent) return 1;
4452 sds first_cfg = NULL;
4453 listIter li;
4454 listNode *ln;
4455 listRewind(cluster_manager.nodes, &li);
4456 while ((ln = listNext(&li)) != NULL) {
4457 clusterManagerNode *node = ln->value;
4458 sds cfg = clusterManagerGetConfigSignature(node);
4459 if (cfg == NULL) {
4460 consistent = 0;
4461 break;
4462 }
4463 if (first_cfg == NULL) first_cfg = cfg;
4464 else {
4465 consistent = !sdscmp(first_cfg, cfg);
4466 sdsfree(cfg);
4467 if (!consistent) break;
4468 }
4469 }
4470 if (first_cfg != NULL) sdsfree(first_cfg);
4471 return consistent;
4472}
4473
4474static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) {
4475 list *links = NULL;

Callers 2

Calls 5

listRewindFunction · 0.85
listNextFunction · 0.85
sdscmpFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected