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

Function includeLocalities

fdbclient/SpecialKeySpace.actor.cpp:2594–2626  ·  view source on GitHub ↗

Clears the special management api keys excludeLocality and failedLocality.

Source from the content-addressed store, hash-verified

2592
2593// Clears the special management api keys excludeLocality and failedLocality.
2594void includeLocalities(ReadYourWritesTransaction* ryw) {
2595 ryw->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE);
2596 ryw->setOption(FDBTransactionOptions::LOCK_AWARE);
2597 ryw->setOption(FDBTransactionOptions::RAW_ACCESS);
2598 ryw->setOption(FDBTransactionOptions::USE_PROVISIONAL_PROXIES);
2599 // includeLocalities might be used in an emergency transaction, so make sure it is retry-self-conflicting and
2600 // CAUSAL_WRITE_RISKY
2601 ryw->setOption(FDBTransactionOptions::CAUSAL_WRITE_RISKY);
2602 std::string versionKey = deterministicRandom()->randomUniqueID().toString();
2603 // for excluded localities
2604 auto ranges = ryw->getSpecialKeySpaceWriteMap().containedRanges(
2605 SpecialKeySpace::getManagementApiCommandRange("excludedlocality"));
2606 Transaction& tr = ryw->getTransaction();
2607 for (auto& iter : ranges) {
2608 auto entry = iter.value();
2609 if (entry.first && !entry.second.present()) {
2610 tr.addReadConflictRange(singleKeyRange(excludedLocalityVersionKey));
2611 tr.set(excludedLocalityVersionKey, versionKey);
2612 tr.clear(ryw->getDatabase()->specialKeySpace->decode(iter.range()));
2613 }
2614 }
2615 // for failed localities
2616 ranges = ryw->getSpecialKeySpaceWriteMap().containedRanges(
2617 SpecialKeySpace::getManagementApiCommandRange("failedlocality"));
2618 for (auto& iter : ranges) {
2619 auto entry = iter.value();
2620 if (entry.first && !entry.second.present()) {
2621 tr.addReadConflictRange(singleKeyRange(failedLocalityVersionKey));
2622 tr.set(failedLocalityVersionKey, versionKey);
2623 tr.clear(ryw->getDatabase()->specialKeySpace->decode(iter.range()));
2624 }
2625 }
2626}
2627
2628// Reads the excludedlocality and failed locality keys using management api,
2629// parses them and returns the list.

Callers 5

Future<bool> includeFunction · 0.85
workloadMainMethod · 0.85
removeAndKillMethod · 0.85

Calls 15

deterministicRandomFunction · 0.85
singleKeyRangeFunction · 0.85
randomUniqueIDMethod · 0.80
containedRangesMethod · 0.80
setOptionMethod · 0.65
addReadConflictRangeMethod · 0.65
setMethod · 0.65
clearMethod · 0.65
getDatabaseMethod · 0.65
toStringMethod · 0.45
getTransactionMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected