Merge pull request #2870 from dongxinEric/feature/2399/provide-comprehensive-info-about-exclude-in-fdbcli

Instead of providing partial information about exclude results in dif…
This commit is contained in:
Xin Dong 2020-03-31 11:58:41 -07:00 committed by GitHub
commit 8e489e7031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 20 deletions

View File

@ -2211,36 +2211,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 process 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());
}
}