Return the greatest configEpoch found in the cluster, or the current * epoch if greater than any node configEpoch. */
| 1095 | /* Return the greatest configEpoch found in the cluster, or the current |
| 1096 | * epoch if greater than any node configEpoch. */ |
| 1097 | uint64_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: |
no test coverage detected