MCPcopy Create free account
hub / github.com/apple/foundationdb / removeMachine

Method removeMachine

fdbserver/DDTeamCollection.actor.cpp:4856–4895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4854}
4855
4856void DDTeamCollection::removeMachine(Reference<TCMachineInfo> removedMachineInfo) {
4857 // Find machines that share teams with the removed machine
4858 std::set<Standalone<StringRef>> machinesWithAjoiningTeams;
4859 for (auto& machineTeam : removedMachineInfo->machineTeams) {
4860 machinesWithAjoiningTeams.insert(machineTeam->getMachineIDs().begin(), machineTeam->getMachineIDs().end());
4861 }
4862 machinesWithAjoiningTeams.erase(removedMachineInfo->machineID);
4863 // For each machine in a machine team with the removed machine,
4864 // erase shared machine teams from the list of teams.
4865 for (auto it = machinesWithAjoiningTeams.begin(); it != machinesWithAjoiningTeams.end(); ++it) {
4866 auto& machineTeams = machine_info[*it]->machineTeams;
4867 for (int t = 0; t < machineTeams.size(); t++) {
4868 auto& machineTeam = machineTeams[t];
4869 if (machineTeam->containsMachine(removedMachineInfo->machineID)) {
4870 machineTeams[t--] = machineTeams.back();
4871 machineTeams.pop_back();
4872 }
4873 }
4874 }
4875 removedMachineInfo->machineTeams.clear();
4876
4877 // Remove global machine team that includes removedMachineInfo
4878 for (int t = 0; t < machineTeams.size(); t++) {
4879 auto& machineTeam = machineTeams[t];
4880 if (machineTeam->containsMachine(removedMachineInfo->machineID)) {
4881 removeMachineTeam(machineTeam);
4882 // removeMachineTeam will swap the last team in machineTeams vector into [t];
4883 // t-- to avoid skipping the element
4884 t--;
4885 }
4886 }
4887
4888 // Remove removedMachineInfo from machine's global info
4889 machine_info.erase(removedMachineInfo->machineID);
4890 TraceEvent("MachineLocalityMapUpdate").detail("MachineUIDRemoved", removedMachineInfo->machineID.toString());
4891
4892 // We do not update macineLocalityMap when a machine is removed because we will do so when we use it in
4893 // addBestMachineTeams()
4894 // rebuildMachineLocalityMap();
4895}
4896
4897bool DDTeamCollection::removeMachineTeam(Reference<TCMachineTeamInfo> targetMT) {
4898 bool foundMachineTeam = false;

Callers 1

whenFunction · 0.80

Calls 12

TraceEventClass · 0.85
containsMachineMethod · 0.80
detailMethod · 0.80
clearMethod · 0.65
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected