mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-09 00:13:31 +00:00
Merge 'Coroutinize sstable_directory registry garbage collecting method' from Pavel Emelyanov
null Closes scylladb/scylladb#20172 * github.com:scylladb/scylladb: sstable_directory: Coroutinize inner lambdas sstable_directory: Fix indentation after previous patch sstable_directory: Coroutinize outer cotinuation chain
This commit is contained in:
@@ -384,20 +384,18 @@ future<> sstable_directory::sstables_registry_components_lister::commit() {
|
||||
}
|
||||
|
||||
future<> sstable_directory::sstables_registry_components_lister::garbage_collect(storage& st) {
|
||||
return do_with(std::set<generation_type>(), [this, &st] (auto& gens_to_remove) {
|
||||
return _sstables_registry.sstables_registry_list(_location, [&st, &gens_to_remove] (sstring status, sstable_state state, entry_descriptor desc) {
|
||||
if (status == "sealed") {
|
||||
return make_ready_future<>();
|
||||
}
|
||||
std::set<generation_type> gens_to_remove;
|
||||
co_await _sstables_registry.sstables_registry_list(_location, coroutine::lambda([&st, &gens_to_remove] (sstring status, sstable_state state, entry_descriptor desc) -> future<> {
|
||||
if (status == "sealed") {
|
||||
co_return;
|
||||
}
|
||||
|
||||
dirlog.info("Removing dangling {} {} entry", desc.generation, status);
|
||||
gens_to_remove.insert(desc.generation);
|
||||
return st.remove_by_registry_entry(std::move(desc));
|
||||
}).then([this, &gens_to_remove] {
|
||||
return parallel_for_each(gens_to_remove, [this] (auto gen) {
|
||||
return _sstables_registry.delete_entry(_location, gen);
|
||||
});
|
||||
});
|
||||
dirlog.info("Removing dangling {} {} entry", desc.generation, status);
|
||||
gens_to_remove.insert(desc.generation);
|
||||
co_await st.remove_by_registry_entry(std::move(desc));
|
||||
}));
|
||||
co_await coroutine::parallel_for_each(gens_to_remove, [this] (auto gen) -> future<> {
|
||||
co_await _sstables_registry.delete_entry(_location, gen);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user