Clean up empty physical shards in KVS. (#7674)
This commit is contained in:
parent
4f75f01882
commit
5ee40bbc5f
|
@ -8607,10 +8607,19 @@ ACTOR Future<Void> updateStorage(StorageServer* data) {
|
|||
.detail("OldestRemoveKVSRangesVersion", data->pendingRemoveRanges.begin()->first);
|
||||
ASSERT(newOldestVersion <= data->pendingRemoveRanges.begin()->first);
|
||||
if (newOldestVersion == data->pendingRemoveRanges.begin()->first) {
|
||||
state std::vector<std::string> emptyShardIds;
|
||||
for (const auto& range : data->pendingRemoveRanges.begin()->second) {
|
||||
data->storage.removeRange(range);
|
||||
auto ids = data->storage.removeRange(range);
|
||||
emptyShardIds.insert(emptyShardIds.end(), ids.begin(), ids.end());
|
||||
TraceEvent(SevVerbose, "RemoveKVSRange", data->thisServerID).detail("Range", range);
|
||||
}
|
||||
if (emptyShardIds.size() > 0) {
|
||||
state double start = now();
|
||||
wait(data->storage.cleanUpShardsIfNeeded(emptyShardIds));
|
||||
TraceEvent(SevInfo, "RemoveEmptyPhysicalShards", data->thisServerID)
|
||||
.detail("NumShards", emptyShardIds.size())
|
||||
.detail("TimeSpent", now() - start);
|
||||
}
|
||||
data->pendingRemoveRanges.erase(data->pendingRemoveRanges.begin());
|
||||
}
|
||||
removeKVSRanges = false;
|
||||
|
|
Loading…
Reference in New Issue