Skip to content

Commit d3210f7

Browse files
authored
Merge branch 'release-7.2' into wal-fix
2 parents b7684b2 + cf65c26 commit d3210f7

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

fdbclient/SpecialKeySpace.actor.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,9 @@ ACTOR Future<bool> checkExclusion(Database db,
999999
state int64_t totalKvStoreFreeBytes = 0;
10001000
state int64_t totalKvStoreUsedBytes = 0;
10011001
state int64_t totalKvStoreUsedBytesNonExcluded = 0;
1002+
// Keep track if we exclude any storage process with the provided adddresses
1003+
state bool excludedAddressesContainsStorageRole = false;
1004+
10021005
try {
10031006
for (auto proc : processesMap.obj()) {
10041007
StatusObjectReader process(proc.second);
@@ -1008,8 +1011,8 @@ ACTOR Future<bool> checkExclusion(Database db,
10081011
return false;
10091012
}
10101013
NetworkAddress addr = NetworkAddress::parse(addrStr);
1011-
bool excluded =
1012-
(process.has("excluded") && process.last().get_bool()) || addressExcluded(*exclusions, addr);
1014+
bool includedInExclusion = addressExcluded(*exclusions, addr);
1015+
bool excluded = (process.has("excluded") && process.last().get_bool()) || includedInExclusion;
10131016

10141017
StatusObjectReader localityObj;
10151018
std::string disk_id;
@@ -1022,6 +1025,12 @@ ACTOR Future<bool> checkExclusion(Database db,
10221025
if (role["role"].get_str() == "storage") {
10231026
ssTotalCount++;
10241027

1028+
// Check if we are excluding a process that serves the storage role. We only have to check the free
1029+
// capacity if we are excluding at least one process that serves the storage role.
1030+
if (!excludedAddressesContainsStorageRole && includedInExclusion) {
1031+
excludedAddressesContainsStorageRole = true;
1032+
}
1033+
10251034
int64_t used_bytes;
10261035
if (!role.get("kvstore_used_bytes", used_bytes)) {
10271036
*msg = ManagementAPIError::toJsonString(
@@ -1061,6 +1070,12 @@ ACTOR Future<bool> checkExclusion(Database db,
10611070
return false;
10621071
}
10631072

1073+
// If the exclusion command only contains processes that serve a non storage role we can skip the free capacity
1074+
// check in order to not block those exclusions.
1075+
if (!excludedAddressesContainsStorageRole) {
1076+
return true;
1077+
}
1078+
10641079
double finalFreeRatio = 1 - (totalKvStoreUsedBytes / (totalKvStoreUsedBytesNonExcluded + totalKvStoreFreeBytes));
10651080
if (ssExcludedCount == ssTotalCount || finalFreeRatio <= 0.1) {
10661081
std::string temp = "ERROR: This exclude may cause the total free space in the cluster to drop below 10%.\n"

0 commit comments

Comments
 (0)