mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 10:22:20 +08:00
change exclusions so that they calculate free space based on storage servers only
This commit is contained in:
parent
50fb44be92
commit
f6d282e66a
@ -1674,7 +1674,18 @@ ACTOR Future<bool> exclude( Database db, std::vector<StringRef> tokens, Referenc
|
|||||||
state double worstFreeSpaceRatio = 1.0;
|
state double worstFreeSpaceRatio = 1.0;
|
||||||
try {
|
try {
|
||||||
for (auto proc : processesMap.obj()){
|
for (auto proc : processesMap.obj()){
|
||||||
|
bool storageServer = false;
|
||||||
StatusArray rolesArray = proc.second.get_obj()["roles"].get_array();
|
StatusArray rolesArray = proc.second.get_obj()["roles"].get_array();
|
||||||
|
for (StatusObjectReader role : rolesArray) {
|
||||||
|
if (role["role"].get_str() == "storage") {
|
||||||
|
storageServer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Skip non-storage servers in free space calculation
|
||||||
|
if (!storageServer)
|
||||||
|
continue;
|
||||||
|
|
||||||
StatusObjectReader process(proc.second);
|
StatusObjectReader process(proc.second);
|
||||||
std::string addrStr;
|
std::string addrStr;
|
||||||
if (!process.get("address", addrStr)) {
|
if (!process.get("address", addrStr)) {
|
||||||
@ -1683,6 +1694,9 @@ ACTOR Future<bool> exclude( Database db, std::vector<StringRef> tokens, Referenc
|
|||||||
}
|
}
|
||||||
NetworkAddress addr = NetworkAddress::parse(addrStr);
|
NetworkAddress addr = NetworkAddress::parse(addrStr);
|
||||||
bool excluded = (process.has("excluded") && process.last().get_bool()) || addressExcluded(exclusions, addr);
|
bool excluded = (process.has("excluded") && process.last().get_bool()) || addressExcluded(exclusions, addr);
|
||||||
|
ssTotalCount++;
|
||||||
|
if (excluded)
|
||||||
|
ssExcludedCount++;
|
||||||
|
|
||||||
if(!excluded) {
|
if(!excluded) {
|
||||||
StatusObjectReader disk;
|
StatusObjectReader disk;
|
||||||
@ -1705,15 +1719,6 @@ ACTOR Future<bool> exclude( Database db, std::vector<StringRef> tokens, Referenc
|
|||||||
|
|
||||||
worstFreeSpaceRatio = std::min(worstFreeSpaceRatio, double(free_bytes)/total_bytes);
|
worstFreeSpaceRatio = std::min(worstFreeSpaceRatio, double(free_bytes)/total_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (StatusObjectReader role : rolesArray) {
|
|
||||||
if (role["role"].get_str() == "storage") {
|
|
||||||
if (excluded)
|
|
||||||
ssExcludedCount++;
|
|
||||||
ssTotalCount++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...) // std::exception
|
catch (...) // std::exception
|
||||||
|
Loading…
x
Reference in New Issue
Block a user