From c8db205fd94d6af8bb93e882a06a29ef153026b1 Mon Sep 17 00:00:00 2001 From: Meng Xu Date: Tue, 12 Feb 2019 16:18:17 -0800 Subject: [PATCH] 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. --- fdbserver/DataDistribution.actor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fdbserver/DataDistribution.actor.cpp b/fdbserver/DataDistribution.actor.cpp index 1182863b58..d2c67cce3c 100644 --- a/fdbserver/DataDistribution.actor.cpp +++ b/fdbserver/DataDistribution.actor.cpp @@ -2019,7 +2019,7 @@ struct DDTeamCollection : ReferenceCounted { 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 { machineTeam = addMachineTeam(machineIDs.begin(), machineIDs.end()); } + machineTeam->serverTeams.push_back(serverTeam); + return machineTeam; } @@ -2216,9 +2218,8 @@ struct DDTeamCollection : ReferenceCounted { 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++; } }