fix: do not load the userRangeConfig if large teams are not enabled

fix: do not build a large team which is the same size as the storage team size
fix: large teams should not count towards the healthyTeamCount
This commit is contained in:
Evan Tschannen 2023-04-19 20:38:03 -07:00
parent edb071c6f2
commit f7dc2d9c76
2 changed files with 50 additions and 45 deletions

View File

@ -708,7 +708,7 @@ public:
state bool lastHealthy;
state bool lastOptimal;
state bool lastWrongConfiguration = team->isWrongConfiguration();
state bool trackHealthyTeam = team->size() == self->configuration.storageTeamSize;
state bool lastZeroHealthy = self->zeroHealthyTeams->get();
state bool firstCheck = true;
@ -797,7 +797,7 @@ public:
lastReady = self->initialFailureReactionDelay.isReady();
lastZeroHealthy = self->zeroHealthyTeams->get();
if (firstCheck) {
if (firstCheck && trackHealthyTeam) {
firstCheck = false;
if (healthy) {
self->healthyTeamCount++;
@ -828,35 +828,37 @@ public:
team->setWrongConfiguration(anyWrongConfiguration);
if (optimal != lastOptimal) {
lastOptimal = optimal;
self->optimalTeamCount += optimal ? 1 : -1;
if (trackHealthyTeam) {
if (optimal != lastOptimal) {
lastOptimal = optimal;
self->optimalTeamCount += optimal ? 1 : -1;
ASSERT_GE(self->optimalTeamCount, 0);
self->zeroOptimalTeams.set(self->optimalTeamCount == 0);
}
if (lastHealthy != healthy) {
lastHealthy = healthy;
// Update healthy team count when the team healthy changes
self->healthyTeamCount += healthy ? 1 : -1;
ASSERT_GE(self->healthyTeamCount, 0);
self->zeroHealthyTeams->set(self->healthyTeamCount == 0);
if (self->healthyTeamCount == 0) {
TraceEvent(SevWarn, "ZeroServerTeamsHealthySignalling", self->distributorId)
.detail("SignallingTeam", team->getDesc())
.detail("Primary", self->primary);
ASSERT_GE(self->optimalTeamCount, 0);
self->zeroOptimalTeams.set(self->optimalTeamCount == 0);
}
if (logTeamEvents) {
TraceEvent("ServerTeamHealthDifference", self->distributorId)
.detail("ServerTeam", team->getDesc())
.detail("LastOptimal", lastOptimal)
.detail("LastHealthy", lastHealthy)
.detail("Optimal", optimal)
.detail("OptimalTeamCount", self->optimalTeamCount);
if (lastHealthy != healthy) {
lastHealthy = healthy;
// Update healthy team count when the team healthy changes
self->healthyTeamCount += healthy ? 1 : -1;
ASSERT_GE(self->healthyTeamCount, 0);
self->zeroHealthyTeams->set(self->healthyTeamCount == 0);
if (self->healthyTeamCount == 0) {
TraceEvent(SevWarn, "ZeroServerTeamsHealthySignalling", self->distributorId)
.detail("SignallingTeam", team->getDesc())
.detail("Primary", self->primary);
}
if (logTeamEvents) {
TraceEvent("ServerTeamHealthDifference", self->distributorId)
.detail("ServerTeam", team->getDesc())
.detail("LastOptimal", lastOptimal)
.detail("LastHealthy", lastHealthy)
.detail("Optimal", optimal)
.detail("OptimalTeamCount", self->optimalTeamCount);
}
}
}
@ -1031,21 +1033,23 @@ public:
.detail("Priority", team->getPriority());
}
self->priority_teams[team->getPriority()]--;
if (team->isHealthy()) {
self->healthyTeamCount--;
ASSERT_GE(self->healthyTeamCount, 0);
if (trackHealthyTeam) {
if (team->isHealthy()) {
self->healthyTeamCount--;
ASSERT_GE(self->healthyTeamCount, 0);
if (self->healthyTeamCount == 0) {
TraceEvent(SevWarn, "ZeroTeamsHealthySignalling", self->distributorId)
.detail("ServerPrimary", self->primary)
.detail("SignallingServerTeam", team->getDesc());
self->zeroHealthyTeams->set(true);
if (self->healthyTeamCount == 0) {
TraceEvent(SevWarn, "ZeroTeamsHealthySignalling", self->distributorId)
.detail("ServerPrimary", self->primary)
.detail("SignallingServerTeam", team->getDesc());
self->zeroHealthyTeams->set(true);
}
}
if (lastOptimal) {
self->optimalTeamCount--;
ASSERT_GE(self->optimalTeamCount, 0);
self->zeroOptimalTeams.set(self->optimalTeamCount == 0);
}
}
if (lastOptimal) {
self->optimalTeamCount--;
ASSERT_GE(self->optimalTeamCount, 0);
self->zeroOptimalTeams.set(self->optimalTeamCount == 0);
}
throw;
}
@ -4191,7 +4195,7 @@ Reference<TCTeamInfo> DDTeamCollection::buildLargeTeam(int teamSize) {
}
candidateTeam.push_back(sortedServers[i].info);
}
if (!satisfiesPolicy(candidateTeam)) {
if (candidateTeam.size() <= configuration.storageTeamSize || !satisfiesPolicy(candidateTeam)) {
TraceEvent(SevWarnAlways, "TooFewServersForLargeTeam", distributorId)
.suppressFor(1.0)
.detail("TeamSize", candidateTeam.size())

View File

@ -242,9 +242,10 @@ class DDTxnProcessorImpl {
state Transaction tr(cx);
wait(store(*result->userRangeConfig,
DDConfiguration().userRangeConfig().getSnapshot(cx.getReference(), allKeys.begin, allKeys.end)));
if (ddLargeTeamEnabled()) {
wait(store(*result->userRangeConfig,
DDConfiguration().userRangeConfig().getSnapshot(cx.getReference(), allKeys.begin, allKeys.end)));
}
state std::map<UID, Optional<Key>> server_dc;
state std::map<std::vector<UID>, std::pair<std::vector<UID>, std::vector<UID>>> team_cache;
state std::vector<std::pair<StorageServerInterface, ProcessClass>> tss_servers;