MCPcopy Create free account
hub / github.com/apple/foundationdb / updateConfigForForcedRecovery

Function updateConfigForForcedRecovery

fdbserver/ClusterRecovery.actor.cpp:1289–1326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1287}
1288
1289void 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
1328ACTOR Future<Void> recoverFrom(Reference<ClusterRecoveryData> self,
1329 Reference<ILogSystem> oldLogSystem,

Callers 1

Future<Void> recoverFromFunction · 0.85

Calls 14

MutationRefClass · 0.85
IncludeVersionFunction · 0.85
TraceEventClass · 0.85
getRegionJSONMethod · 0.80
detailMethod · 0.80
getMethod · 0.65
sort_by_priorityClass · 0.50
push_back_deepMethod · 0.45
toStringMethod · 0.45
applyMutationMethod · 0.45
backMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected