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

Function excludeLocalities

fdbclient/ManagementAPI.actor.cpp:1380–1397  ·  view source on GitHub ↗

excludes localities by setting the keys in api version below 7.0

Source from the content-addressed store, hash-verified

1378
1379// excludes localities by setting the keys in api version below 7.0
1380void excludeLocalities(Transaction& tr, std::unordered_set<std::string> localities, bool failed) {
1381 tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
1382 tr.setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
1383 tr.setOption(FDBTransactionOptions::LOCK_AWARE);
1384 tr.setOption(FDBTransactionOptions::USE_PROVISIONAL_PROXIES);
1385 std::string excludeVersionKey = deterministicRandom()->randomUniqueID().toString();
1386 auto localityVersionKey = failed ? failedLocalityVersionKey : excludedLocalityVersionKey;
1387 tr.addReadConflictRange(singleKeyRange(localityVersionKey)); // To conflict with parallel includeLocalities
1388 tr.set(localityVersionKey, excludeVersionKey);
1389 for (const auto& l : localities) {
1390 if (failed) {
1391 tr.set(encodeFailedLocalityKey(l), StringRef());
1392 } else {
1393 tr.set(encodeExcludedLocalityKey(l), StringRef());
1394 }
1395 }
1396 TraceEvent("ExcludeLocalitiesCommit").detail("Localities", describe(localities)).detail("ExcludeFailed", failed);
1397}
1398
1399// Exclude the servers matching the given set of localities from use as state servers.
1400// excludes localities by setting the keys.

Callers 3

ifMethod · 0.85

Calls 13

deterministicRandomFunction · 0.85
singleKeyRangeFunction · 0.85
encodeFailedLocalityKeyFunction · 0.85
TraceEventClass · 0.85
randomUniqueIDMethod · 0.80
detailMethod · 0.80
describeFunction · 0.70
setOptionMethod · 0.65
addReadConflictRangeMethod · 0.65
setMethod · 0.65
StringRefClass · 0.50

Tested by 1