compaction: introduce compaction_read_monitor_generator::remove_exhausted_sstables()

This new function makes it easier to remove monitor of exhausted
sstables.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2021-09-20 15:16:38 -03:00
parent 28ba8bde80
commit 3dc1821287

View File

@@ -381,11 +381,13 @@ struct compaction_read_monitor_generator final : public read_monitor_generator {
}
}
void remove_sstable(bool is_tracking, sstables::shared_sstable& sst) {
auto it = _generated_monitors.find(sst);
if (it != _generated_monitors.end()) {
it->second.remove_sstable(is_tracking);
_generated_monitors.erase(it);
void remove_exhausted_sstables(bool is_tracking, const std::vector<sstables::shared_sstable>& exhausted_sstables) {
for (auto &sst : exhausted_sstables) {
auto it = _generated_monitors.find(sst);
if (it != _generated_monitors.end()) {
it->second.remove_sstable(is_tracking);
_generated_monitors.erase(it);
}
}
}
private:
@@ -1040,9 +1042,7 @@ private:
// an early sstable replacement.
//
for (auto& sst : exhausted_sstables) {
_monitor_generator.remove_sstable(_info->tracking, sst);
}
_monitor_generator.remove_exhausted_sstables(_info->tracking, exhausted_sstables);
auto& tracker = _cf.get_compaction_strategy().get_backlog_tracker();
for (auto& sst : _unused_sstables) {
tracker.add_sstable(sst);