From ae622d711e6207bc041ad73ff7fa41bbc213ccec Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 28 May 2024 11:01:48 +0300 Subject: [PATCH] sstables-loader: Run loading in its scheduling group Now the loading code has two different paths, and only one of them switches sched group. It's cleaner and more natural to switch the sched group in the loader itself, so that all code paths run in it and don't care switching. Signed-off-by: Pavel Emelyanov --- replica/distributed_loader.cc | 5 +---- sstables_loader.cc | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/replica/distributed_loader.cc b/replica/distributed_loader.cc index 7b18e545c7..c46e259fd6 100644 --- a/replica/distributed_loader.cc +++ b/replica/distributed_loader.cc @@ -172,15 +172,12 @@ distributed_loader::make_sstables_available(sstables::sstable_directory& dir, sh future<> distributed_loader::process_upload_dir(distributed& db, sharded& vb, sstring ks, sstring cf) { - seastar::thread_attributes attr; - attr.sched_group = db.local().get_streaming_scheduling_group(); - const auto& rs = db.local().find_keyspace(ks).get_replication_strategy(); if (rs.is_per_table()) { on_internal_error(dblog, "process_upload_dir is not supported with tablets"); } - return seastar::async(std::move(attr), [&db, &vb, ks = std::move(ks), cf = std::move(cf)] { + return seastar::async([&db, &vb, ks = std::move(ks), cf = std::move(cf)] { auto global_table = get_table_on_all_shards(db, ks, cf).get(); sharded directory; diff --git a/sstables_loader.cc b/sstables_loader.cc index d719231688..89ee2dab2b 100644 --- a/sstables_loader.cc +++ b/sstables_loader.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include #include "sstables_loader.hh" @@ -407,6 +408,8 @@ future<> sstables_loader::load_new_sstables(sstring ks_name, sstring cf_name, _loading_new_sstables = true; } + co_await coroutine::switch_to(_sched_group); + sstring load_and_stream_desc = fmt::format("{}", load_and_stream); const auto& rs = _db.local().find_keyspace(ks_name).get_replication_strategy(); if (rs.is_per_table() && !load_and_stream) {