Sort the failed sets before modifying them in attempts to make changes consistent

This commit is contained in:
Jon Fu 2020-11-10 13:50:39 -05:00
parent 9cedac57b0
commit cc13ef08bd
2 changed files with 9 additions and 3 deletions

View File

@ -1607,6 +1607,7 @@ ACTOR Future<std::set<NetworkAddress>> checkForExcludingServers(Database cx, vec
wait( delayJittered( 1.0 ) ); // SOMEDAY: watches!
} catch (Error& e) {
TraceEvent("CheckForExcludingServersError").error(e);
wait( tr.onError(e) );
}
}

View File

@ -408,6 +408,9 @@ struct RemoveServersSafelyWorkload : TestWorkload {
if (coordinators.size() > 2) {
auto randomCoordinator = deterministicRandom()->randomChoice(coordinators);
coordExcl = AddressExclusion(randomCoordinator.ip, randomCoordinator.port);
TraceEvent("RemoveAndKill", functionId)
.detail("Step", "ChooseCoordinator")
.detail("Coordinator", describe(coordExcl));
}
}
std::copy(toKill.begin(), toKill.end(), std::back_inserter(toKillArray));
@ -417,11 +420,12 @@ struct RemoveServersSafelyWorkload : TestWorkload {
state bool safe = false;
state std::set<AddressExclusion> failSet =
random_subset(toKillArray, deterministicRandom()->randomInt(0, toKillArray.size() + 1));
if (coordExcl.isValid()) {
failSet.insert(coordExcl);
}
toKillMarkFailedArray.resize(failSet.size());
std::copy(failSet.begin(), failSet.end(), toKillMarkFailedArray.begin());
std::sort(toKillMarkFailedArray.begin(), toKillMarkFailedArray.end());
if (coordExcl.isValid()) {
toKillMarkFailedArray.push_back(coordExcl);
}
TraceEvent("RemoveAndKill", functionId)
.detail("Step", "SafetyCheck")
.detail("Exclusions", describe(toKillMarkFailedArray));
@ -460,6 +464,7 @@ struct RemoveServersSafelyWorkload : TestWorkload {
toKillMarkFailedArray.erase(removeServer);
}
ASSERT(toKillMarkFailedArray.size() <= toKillArray.size());
std::sort(toKillArray.begin(), toKillArray.end());
auto removeServer = toKill.begin();
TraceEvent("RemoveAndKill", functionId)
.detail("Step", "ReplaceNonFailedKillSet")