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

Method isValidLocality

fdbserver/DDTeamCollection.actor.cpp:3743–3760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3741}
3742
3743bool DDTeamCollection::isValidLocality(Reference<IReplicationPolicy> storagePolicy,
3744 const LocalityData& locality) const {
3745 // Future: Once we add simulation test that misconfigure a cluster, such as not setting some locality entries,
3746 // DD_VALIDATE_LOCALITY should always be true. Otherwise, simulation test may fail.
3747 if (!SERVER_KNOBS->DD_VALIDATE_LOCALITY) {
3748 // Disable the checking if locality is valid
3749 return true;
3750 }
3751
3752 std::set<std::string> replicationPolicyKeys = storagePolicy->attributeKeys();
3753 for (auto& policy : replicationPolicyKeys) {
3754 if (!locality.isPresent(policy)) {
3755 return false;
3756 }
3757 }
3758
3759 return true;
3760}
3761
3762void DDTeamCollection::evaluateTeamQuality() const {
3763 int teamCount = teams.size(), serverCount = allServers.size();

Callers 4

Future<Void> initFunction · 0.80
whenFunction · 0.80

Calls 2

attributeKeysMethod · 0.45
isPresentMethod · 0.45

Tested by

no test coverage detected