Clears the special management api keys excludeLocality and failedLocality.
| 2592 | |
| 2593 | // Clears the special management api keys excludeLocality and failedLocality. |
| 2594 | void 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. |
no test coverage detected