sstables: Implement sstable_set_impl::all_sstable_runs()
With upcoming change where table::set_compaction_strategy() might delay update of sstable set, ICS might temporarily work with sstable set implementations other than partitioned_sstable_set. ICS relies on all_sstable_runs() during regular compaction, and today it triggers bad_function_call exception if not overriden by set implementation. To remove this strong dependency between compaction strategy and a particular set implementation, let's provide a default implementation of all_sstable_runs(), such that ICS will still work until the set is updated eventually through a process that adds or remove a sstable. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -945,7 +945,21 @@ filter_sstable_for_reader_by_ck(std::vector<shared_sstable>&& sstables, replica:
|
||||
|
||||
std::vector<frozen_sstable_run>
|
||||
sstable_set_impl::all_sstable_runs() const {
|
||||
throw_with_backtrace<std::bad_function_call>();
|
||||
auto all_sstables = all();
|
||||
std::unordered_map<sstables::run_id, sstable_run> runs_m;
|
||||
std::vector<frozen_sstable_run> all_runs;
|
||||
|
||||
for (auto&& sst : *all_sstables) {
|
||||
// When a run cannot accept sstable due to overlapping, treat the rejected sstable
|
||||
// as a single-fragment run.
|
||||
if (!runs_m[sst->run_identifier()].insert(sst)) {
|
||||
all_runs.push_back(make_lw_shared<const sstable_run>(sst));
|
||||
}
|
||||
}
|
||||
for (auto&& r : runs_m | std::views::values) {
|
||||
all_runs.push_back(make_lw_shared<const sstable_run>(std::move(r)));
|
||||
}
|
||||
return all_runs;
|
||||
}
|
||||
|
||||
mutation_reader
|
||||
|
||||
Reference in New Issue
Block a user