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

Function clusterGetMaxEpoch

src/cluster.cpp:1097–1110  ·  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

1095/* Return the greatest configEpoch found in the cluster, or the current
1096 * epoch if greater than any node configEpoch. */
1097uint64_t clusterGetMaxEpoch(void) {
1098 uint64_t max = 0;
1099 dictIterator *di;
1100 dictEntry *de;
1101
1102 di = dictGetSafeIterator(g_pserver->cluster->nodes);
1103 while((de = dictNext(di)) != NULL) {
1104 clusterNode *node = (clusterNode*)dictGetVal(de);
1105 if (node->configEpoch > max) max = node->configEpoch;
1106 }
1107 dictReleaseIterator(di);
1108 if (max < g_pserver->cluster->currentEpoch) max = g_pserver->cluster->currentEpoch;
1109 return max;
1110}
1111
1112/* If this node epoch is zero or is not already the greatest across the
1113 * 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