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