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

Method notEnoughTeamsForAServer

fdbserver/DDTeamCollection.actor.cpp:4488–4505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4486}
4487
4488bool DDTeamCollection::notEnoughTeamsForAServer() const {
4489 // We build more teams than we finally want so that we can use serverTeamRemover() actor to remove the teams
4490 // whose member belong to too many teams. This allows us to get a more balanced number of teams per server.
4491 // We want to ensure every server has targetTeamNumPerServer teams.
4492 // The numTeamsPerServerFactor is calculated as
4493 // (SERVER_KNOBS->DESIRED_TEAMS_PER_SERVER + ideal_num_of_teams_per_server) / 2
4494 // ideal_num_of_teams_per_server is (#teams * storageTeamSize) / #servers, which is
4495 // (#servers * DESIRED_TEAMS_PER_SERVER * storageTeamSize) / #servers.
4496 int targetTeamNumPerServer = (SERVER_KNOBS->DESIRED_TEAMS_PER_SERVER * (configuration.storageTeamSize + 1)) / 2;
4497 ASSERT_GT(targetTeamNumPerServer, 0);
4498 for (auto& [serverID, server] : server_info) {
4499 if (server->getTeams().size() < targetTeamNumPerServer && !server_status.get(serverID).isUnhealthy()) {
4500 return true;
4501 }
4502 }
4503
4504 return false;
4505}
4506
4507int DDTeamCollection::addTeamsBestOf(int teamsToBuild, int desiredTeams, int maxTeams) {
4508 ASSERT_GE(teamsToBuild, 0);

Callers 1

Calls 3

isUnhealthyMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected