If this node epoch is zero or is not already the greatest across the * cluster (from the POV of the local configuration), this function will: * * 1) Generate a new config epoch, incrementing the current epoch. * 2) Assign the new epoch to this node, WITHOUT any consensus. * 3) Persist the configuration on disk before sending packets with the * new configuration. * * If the new config ep
| 1139 | * config epochs. However using this function may violate the "last failover |
| 1140 | * wins" rule, so should only be used with care. */ |
| 1141 | int clusterBumpConfigEpochWithoutConsensus(void) { |
| 1142 | uint64_t maxEpoch = clusterGetMaxEpoch(); |
| 1143 | |
| 1144 | if (myself->configEpoch == 0 || |
| 1145 | myself->configEpoch != maxEpoch) |
| 1146 | { |
| 1147 | g_pserver->cluster->currentEpoch++; |
| 1148 | myself->configEpoch = g_pserver->cluster->currentEpoch; |
| 1149 | clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG| |
| 1150 | CLUSTER_TODO_FSYNC_CONFIG); |
| 1151 | serverLog(LL_WARNING, |
| 1152 | "New configEpoch set to %llu", |
| 1153 | (unsigned long long) myself->configEpoch); |
| 1154 | return C_OK; |
| 1155 | } else { |
| 1156 | return C_ERR; |
| 1157 | } |
| 1158 | } |
| 1159 | |
| 1160 | /* This function is called when this node is a master, and we receive from |
| 1161 | * another master a configuration epoch that is equal to our configuration |
no test coverage detected