TeamRemover: Change ASSERT in teamRemover function

When we remove a machine team in teamRemover function,
we should always find the machine team in the global machineTeams.
Change the ASSERT to the above invariant.
This commit is contained in:
Meng Xu 2019-02-18 23:25:07 -08:00
parent 3c1ed2eba9
commit e256d9a9ac
1 changed files with 2 additions and 4 deletions

View File

@ -2343,13 +2343,12 @@ ACTOR Future<Void> teamRemover(DDTeamCollection* self) {
// Remove the machine by removing its process team one by one
state Reference<TCTeamInfo> team;
state int teamIndex = 0;
state bool foundTeam = false;
for (teamIndex = 0; teamIndex < mt->serverTeams.size(); ++teamIndex) {
team = mt->serverTeams[teamIndex];
ASSERT(team->machineTeam->machineIDs == mt->machineIDs); // Sanity check
// The team will be marked as a bad team
foundTeam = self->removeTeam(team);
bool foundTeam = self->removeTeam(team);
ASSERT(foundTeam == true);
// removeTeam() has side effect of swapping the last element to the current pos
// in the serverTeams vector in the machine team.
@ -2374,8 +2373,7 @@ ACTOR Future<Void> teamRemover(DDTeamCollection* self) {
// When we remove the last server team on a machine team in removeTeam(), we also remove the machine team
// This is needed for removeTeam() functoin.
// So here the removeMachineTeam() should not find the machine team
// TODO: Change it back to ASSERT(foundRemovedMachineTeam);
ASSERT(foundTeam == true || foundRemovedMachineTeam == true);
ASSERT(foundRemovedMachineTeam);
numMachineTeamRemoved++;
} else {
if (numMachineTeamRemoved > 0) {