TeamCollection: Fix bug in remove a server
When we remove a server due to server failure, we need to remove the related server teams AND remove the server team from the machine team. In the previous commit, we forgot to remove the server team from the machine team.
This commit is contained in:
parent
fe4f43203d
commit
c8db205fd9
|
@ -2019,7 +2019,7 @@ struct DDTeamCollection : ReferenceCounted<DDTeamCollection> {
|
|||
ASSERT(found);
|
||||
server->teams[t--] = server->teams.back();
|
||||
server->teams.pop_back();
|
||||
break;
|
||||
break; // The teams on a server should not be duplicate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2078,6 +2078,8 @@ struct DDTeamCollection : ReferenceCounted<DDTeamCollection> {
|
|||
machineTeam = addMachineTeam(machineIDs.begin(), machineIDs.end());
|
||||
}
|
||||
|
||||
machineTeam->serverTeams.push_back(serverTeam);
|
||||
|
||||
return machineTeam;
|
||||
}
|
||||
|
||||
|
@ -2216,9 +2218,8 @@ struct DDTeamCollection : ReferenceCounted<DDTeamCollection> {
|
|||
TraceEvent("TeamRemoved")
|
||||
.detail("Primary", primary)
|
||||
.detail("TeamServerIDs", teams[t]->getServerIDsStr());
|
||||
teams[t]->tracker.cancel();
|
||||
teams[t--] = teams.back();
|
||||
teams.pop_back();
|
||||
// removeTeam also needs to remove the team from the machine team info.
|
||||
removeTeam(teams[t]);
|
||||
removedCount++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue