Instead of providing partial information about exclude results in different scenarios, provide comprehensive result for all cases.
This commit is contained in:
parent
0547cf2b4c
commit
248a097c58
|
@ -2208,36 +2208,44 @@ ACTOR Future<bool> exclude( Database db, std::vector<StringRef> tokens, Referenc
|
|||
workerPorts[addr.address.ip].insert(addr.address.port);
|
||||
|
||||
// Print a list of all excluded addresses that don't have a corresponding worker
|
||||
std::vector<AddressExclusion> absentExclusions;
|
||||
std::set<AddressExclusion> absentExclusions;
|
||||
for(auto addr : addresses) {
|
||||
auto worker = workerPorts.find(addr.ip);
|
||||
if(worker == workerPorts.end())
|
||||
absentExclusions.push_back(addr);
|
||||
absentExclusions.insert(addr);
|
||||
else if(addr.port > 0 && worker->second.count(addr.port) == 0)
|
||||
absentExclusions.push_back(addr);
|
||||
absentExclusions.insert(addr);
|
||||
}
|
||||
|
||||
if(!absentExclusions.empty()) {
|
||||
printf("\nWARNING: the following servers were not present in the cluster. Be sure that you\n"
|
||||
"excluded the correct machines or processes before removing them from the cluster:\n");
|
||||
for(auto addr : absentExclusions) {
|
||||
for (auto addr : addresses) {
|
||||
NetworkAddress _addr(addr.ip, addr.port);
|
||||
if (absentExclusions.find(addr) != absentExclusions.end()) {
|
||||
if(addr.port == 0)
|
||||
printf(" %s\n", addr.ip.toString().c_str());
|
||||
printf(" %s(Whole machine) ---- WARNING: Missing from cluster!Be sure that you excluded the "
|
||||
"correct machines before removing them from the cluster!\n",
|
||||
addr.ip.toString().c_str());
|
||||
else
|
||||
printf(" %s\n", addr.toString().c_str());
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
} else if (notExcludedServers.empty()) {
|
||||
printf("\nIt is now safe to remove these machines or processes from the cluster.\n");
|
||||
} else {
|
||||
printf("\nWARNING: Exclusion in progress. It is not safe to remove the following machines\n"
|
||||
"or processes from the cluster:\n");
|
||||
for (auto addr : notExcludedServers) {
|
||||
printf(" %s ---- WARNING: Missing from cluster!Be sure that you excluded the correct processes "
|
||||
"before removing them from the cluster!\n",
|
||||
addr.toString().c_str());
|
||||
} else if (notExcludedServers.find(_addr) != notExcludedServers.end()) {
|
||||
if (addr.port == 0)
|
||||
printf(" %s\n", addr.ip.toString().c_str());
|
||||
printf(" %s(Whole machine) ---- WARNING: Exclusion in progress! It is not safe to remove this "
|
||||
"machine from the cluster\n",
|
||||
addr.ip.toString().c_str());
|
||||
else
|
||||
printf(" %s\n", addr.toString().c_str());
|
||||
printf(" %s ---- WARNING: Exclusion in progress! It is not safe to remove this processe from the "
|
||||
"cluster\n",
|
||||
addr.toString().c_str());
|
||||
} else {
|
||||
if (addr.port == 0)
|
||||
printf(" %s(Whole machine) ---- Successfully excluded. It is now safe to remove this machine "
|
||||
"from the cluster.\n",
|
||||
addr.ip.toString().c_str());
|
||||
else
|
||||
printf(
|
||||
" %s ---- Successfully excluded. It is now safe to remove this process from the cluster.\n",
|
||||
addr.toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue