diff --git a/compaction/compaction.cc b/compaction/compaction.cc index 22d093e94a..5801f48060 100644 --- a/compaction/compaction.cc +++ b/compaction/compaction.cc @@ -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& 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);