| 1287 | } |
| 1288 | |
| 1289 | void updateConfigForForcedRecovery(Reference<ClusterRecoveryData> self, |
| 1290 | std::vector<Standalone<CommitTransactionRef>>* initialConfChanges) { |
| 1291 | bool regionsChanged = false; |
| 1292 | for (auto& it : self->configuration.regions) { |
| 1293 | if (it.dcId == self->controllerData->clusterControllerDcId.get() && it.priority < 0) { |
| 1294 | it.priority = 1; |
| 1295 | regionsChanged = true; |
| 1296 | } else if (it.dcId != self->controllerData->clusterControllerDcId.get() && it.priority >= 0) { |
| 1297 | it.priority = -1; |
| 1298 | regionsChanged = true; |
| 1299 | } |
| 1300 | } |
| 1301 | Standalone<CommitTransactionRef> regionCommit; |
| 1302 | regionCommit.mutations.push_back_deep( |
| 1303 | regionCommit.arena(), |
| 1304 | MutationRef(MutationRef::SetValue, configKeysPrefix.toString() + "usable_regions", LiteralStringRef("1"))); |
| 1305 | self->configuration.applyMutation(regionCommit.mutations.back()); |
| 1306 | if (regionsChanged) { |
| 1307 | std::sort( |
| 1308 | self->configuration.regions.begin(), self->configuration.regions.end(), RegionInfo::sort_by_priority()); |
| 1309 | StatusObject regionJSON; |
| 1310 | regionJSON["regions"] = self->configuration.getRegionJSON(); |
| 1311 | regionCommit.mutations.push_back_deep( |
| 1312 | regionCommit.arena(), |
| 1313 | MutationRef(MutationRef::SetValue, |
| 1314 | configKeysPrefix.toString() + "regions", |
| 1315 | BinaryWriter::toValue(regionJSON, IncludeVersion(ProtocolVersion::withRegionConfiguration())) |
| 1316 | .toString())); |
| 1317 | self->configuration.applyMutation( |
| 1318 | regionCommit.mutations.back()); // modifying the configuration directly does not change the configuration |
| 1319 | // when it is re-serialized unless we call applyMutation |
| 1320 | TraceEvent("ForcedRecoveryConfigChange", self->dbgid) |
| 1321 | .setMaxEventLength(11000) |
| 1322 | .setMaxFieldLength(10000) |
| 1323 | .detail("Conf", self->configuration.toString()); |
| 1324 | } |
| 1325 | initialConfChanges->push_back(regionCommit); |
| 1326 | } |
| 1327 | |
| 1328 | ACTOR Future<Void> recoverFrom(Reference<ClusterRecoveryData> self, |
| 1329 | Reference<ILogSystem> oldLogSystem, |
no test coverage detected