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

Function clusterGetMaxEpoch

app/redis-6.2.6/src/cluster.c:1058–1071  ·  view source on GitHub ↗

Return the greatest configEpoch found in the cluster, or the current * epoch if greater than any node configEpoch. */

Source from the content-addressed store, hash-verified

1056/* Return the greatest configEpoch found in the cluster, or the current
1057 * epoch if greater than any node configEpoch. */
1058uint64_t clusterGetMaxEpoch(void) {
1059 uint64_t max = 0;
1060 dictIterator *di;
1061 dictEntry *de;
1062
1063 di = dictGetSafeIterator(server.cluster->nodes);
1064 while((de = dictNext(di)) != NULL) {
1065 clusterNode *node = dictGetVal(de);
1066 if (node->configEpoch > max) max = node->configEpoch;
1067 }
1068 dictReleaseIterator(di);
1069 if (max < server.cluster->currentEpoch) max = server.cluster->currentEpoch;
1070 return max;
1071}
1072
1073/* If this node epoch is zero or is not already the greatest across the
1074 * cluster (from the POV of the local configuration), this function will:

Callers 2

clusterLoadConfigFunction · 0.85

Calls 3

dictGetSafeIteratorFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected