Use boolean-param for GetTeamRequest params
This commit is contained in:
parent
7960f77040
commit
129a7b5daf
|
@ -40,6 +40,11 @@ auto get(MapContainer& m, K const& k) -> decltype(m.at(k)) {
|
|||
|
||||
} // namespace
|
||||
|
||||
FDB_DEFINE_BOOLEAN_PARAM(WantNewServers);
|
||||
FDB_DEFINE_BOOLEAN_PARAM(WantTrueBest);
|
||||
FDB_DEFINE_BOOLEAN_PARAM(PreferLowerUtilization);
|
||||
FDB_DEFINE_BOOLEAN_PARAM(TeamMustHaveShards);
|
||||
|
||||
class DDTeamCollectionImpl {
|
||||
ACTOR static Future<Void> checkAndRemoveInvalidLocalityAddr(DDTeamCollection* self) {
|
||||
state double start = now();
|
||||
|
@ -5362,14 +5367,10 @@ public:
|
|||
* don't strictly need new servers and all of these servers are healthy,
|
||||
* maintain status quo.
|
||||
*/
|
||||
|
||||
bool wantsNewServers = false;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = true;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::False, WantTrueBest::True, PreferLowerUtilization::True, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
@ -5419,14 +5420,10 @@ public:
|
|||
* strictly need new servers but '1' is not healthy, see that the other team of
|
||||
* complete sources is selected.
|
||||
*/
|
||||
|
||||
bool wantsNewServers = false;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = true;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0), UID(4, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::False, WantTrueBest::True, PreferLowerUtilization::True, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
@ -5475,13 +5472,10 @@ public:
|
|||
collection->server_info[UID(3, 0)]->setMetrics(high_avail);
|
||||
collection->server_info[UID(4, 0)]->setMetrics(high_avail);
|
||||
|
||||
bool wantsNewServers = true;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = true;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::True, WantTrueBest::True, PreferLowerUtilization::True, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
@ -5529,14 +5523,10 @@ public:
|
|||
* Among server teams that have healthy space available, pick the team that is
|
||||
* most utilized, if the caller says they don't preferLowerUtilization.
|
||||
*/
|
||||
|
||||
bool wantsNewServers = true;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = false;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::True, WantTrueBest::True, PreferLowerUtilization::False, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
@ -5585,14 +5575,10 @@ public:
|
|||
* space, decline to pick that team. Every server must have some minimum
|
||||
* free space defined by the MIN_AVAILABLE_SPACE server knob.
|
||||
*/
|
||||
|
||||
bool wantsNewServers = true;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = true;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::True, WantTrueBest::True, PreferLowerUtilization::True, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
@ -5646,14 +5632,10 @@ public:
|
|||
* test that each server has at least MIN_AVAILABLE_SPACE_RATIO (server knob)
|
||||
* percentage points of capacity free before picking that team.
|
||||
*/
|
||||
|
||||
bool wantsNewServers = true;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = true;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::True, WantTrueBest::True, PreferLowerUtilization::True, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
@ -5699,13 +5681,10 @@ public:
|
|||
collection->wigglingId = UID(4, 0);
|
||||
collection->pauseWiggle = makeReference<AsyncVar<bool>>(true);
|
||||
|
||||
bool wantsNewServers = true;
|
||||
bool wantsTrueBest = true;
|
||||
bool preferLowerUtilization = true;
|
||||
bool teamMustHaveShards = false;
|
||||
std::vector<UID> completeSources{ UID(1, 0), UID(2, 0), UID(3, 0) };
|
||||
|
||||
state GetTeamRequest req(wantsNewServers, wantsTrueBest, preferLowerUtilization, teamMustHaveShards);
|
||||
state GetTeamRequest req(
|
||||
WantNewServers::True, WantTrueBest::True, PreferLowerUtilization::True, TeamMustHaveShards::False);
|
||||
req.completeSources = completeSources;
|
||||
|
||||
wait(collection->getTeam(req));
|
||||
|
|
|
@ -76,6 +76,11 @@ struct IDataDistributionTeam {
|
|||
}
|
||||
};
|
||||
|
||||
FDB_DECLARE_BOOLEAN_PARAM(WantNewServers);
|
||||
FDB_DECLARE_BOOLEAN_PARAM(WantTrueBest);
|
||||
FDB_DECLARE_BOOLEAN_PARAM(PreferLowerUtilization);
|
||||
FDB_DECLARE_BOOLEAN_PARAM(TeamMustHaveShards);
|
||||
|
||||
struct GetTeamRequest {
|
||||
bool wantsNewServers;
|
||||
bool wantsTrueBest;
|
||||
|
@ -87,10 +92,10 @@ struct GetTeamRequest {
|
|||
Promise<std::pair<Optional<Reference<IDataDistributionTeam>>, bool>> reply;
|
||||
|
||||
GetTeamRequest() {}
|
||||
GetTeamRequest(bool wantsNewServers,
|
||||
bool wantsTrueBest,
|
||||
bool preferLowerUtilization,
|
||||
bool teamMustHaveShards,
|
||||
GetTeamRequest(WantNewServers wantsNewServers,
|
||||
WantTrueBest wantsTrueBest,
|
||||
PreferLowerUtilization preferLowerUtilization,
|
||||
TeamMustHaveShards teamMustHaveShards,
|
||||
double inflightPenalty = 1.0)
|
||||
: wantsNewServers(wantsNewServers), wantsTrueBest(wantsTrueBest), preferLowerUtilization(preferLowerUtilization),
|
||||
teamMustHaveShards(teamMustHaveShards), inflightPenalty(inflightPenalty) {}
|
||||
|
|
|
@ -1117,11 +1117,12 @@ ACTOR Future<Void> dataDistributionRelocator(DDQueueData* self, RelocateData rd,
|
|||
rd.healthPriority == SERVER_KNOBS->PRIORITY_TEAM_0_LEFT)
|
||||
inflightPenalty = SERVER_KNOBS->INFLIGHT_PENALTY_ONE_LEFT;
|
||||
|
||||
auto req = GetTeamRequest(rd.wantsNewServers,
|
||||
rd.priority == SERVER_KNOBS->PRIORITY_REBALANCE_UNDERUTILIZED_TEAM,
|
||||
true,
|
||||
false,
|
||||
inflightPenalty);
|
||||
auto req =
|
||||
GetTeamRequest(WantNewServers(rd.wantsNewServers),
|
||||
WantTrueBest(rd.priority == SERVER_KNOBS->PRIORITY_REBALANCE_UNDERUTILIZED_TEAM),
|
||||
PreferLowerUtilization::True,
|
||||
TeamMustHaveShards::False,
|
||||
inflightPenalty);
|
||||
req.src = rd.src;
|
||||
req.completeSources = rd.completeSources;
|
||||
// bestTeam.second = false if the bestTeam in the teamCollection (in the DC) does not have any
|
||||
|
@ -1532,7 +1533,10 @@ ACTOR Future<Void> BgDDMountainChopper(DDQueueData* self, int teamCollectionInde
|
|||
SERVER_KNOBS->DD_REBALANCE_PARALLELISM) {
|
||||
std::pair<Optional<Reference<IDataDistributionTeam>>, bool> _randomTeam =
|
||||
wait(brokenPromiseToNever(self->teamCollections[teamCollectionIndex].getTeam.getReply(
|
||||
GetTeamRequest(true, false, true, false))));
|
||||
GetTeamRequest(WantNewServers::True,
|
||||
WantTrueBest::False,
|
||||
PreferLowerUtilization::True,
|
||||
TeamMustHaveShards::False))));
|
||||
randomTeam = _randomTeam;
|
||||
traceEvent.detail("DestTeam",
|
||||
printable(randomTeam.first.map<std::string>(
|
||||
|
@ -1541,7 +1545,10 @@ ACTOR Future<Void> BgDDMountainChopper(DDQueueData* self, int teamCollectionInde
|
|||
if (randomTeam.first.present()) {
|
||||
std::pair<Optional<Reference<IDataDistributionTeam>>, bool> loadedTeam =
|
||||
wait(brokenPromiseToNever(self->teamCollections[teamCollectionIndex].getTeam.getReply(
|
||||
GetTeamRequest(true, true, false, true))));
|
||||
GetTeamRequest(WantNewServers::True,
|
||||
WantTrueBest::True,
|
||||
PreferLowerUtilization::False,
|
||||
TeamMustHaveShards::True))));
|
||||
|
||||
traceEvent.detail(
|
||||
"SourceTeam",
|
||||
|
@ -1638,7 +1645,10 @@ ACTOR Future<Void> BgDDValleyFiller(DDQueueData* self, int teamCollectionIndex)
|
|||
SERVER_KNOBS->DD_REBALANCE_PARALLELISM) {
|
||||
std::pair<Optional<Reference<IDataDistributionTeam>>, bool> _randomTeam =
|
||||
wait(brokenPromiseToNever(self->teamCollections[teamCollectionIndex].getTeam.getReply(
|
||||
GetTeamRequest(true, false, false, true))));
|
||||
GetTeamRequest(WantNewServers::True,
|
||||
WantTrueBest::False,
|
||||
PreferLowerUtilization::False,
|
||||
TeamMustHaveShards::True))));
|
||||
randomTeam = _randomTeam;
|
||||
traceEvent.detail("SourceTeam",
|
||||
printable(randomTeam.first.map<std::string>(
|
||||
|
@ -1647,7 +1657,10 @@ ACTOR Future<Void> BgDDValleyFiller(DDQueueData* self, int teamCollectionIndex)
|
|||
if (randomTeam.first.present()) {
|
||||
std::pair<Optional<Reference<IDataDistributionTeam>>, bool> unloadedTeam =
|
||||
wait(brokenPromiseToNever(self->teamCollections[teamCollectionIndex].getTeam.getReply(
|
||||
GetTeamRequest(true, true, true, false))));
|
||||
GetTeamRequest(WantNewServers::True,
|
||||
WantTrueBest::True,
|
||||
PreferLowerUtilization::True,
|
||||
TeamMustHaveShards::False))));
|
||||
|
||||
traceEvent.detail(
|
||||
"DestTeam",
|
||||
|
|
Loading…
Reference in New Issue