sstables_loader: load_new_sstables: auto-enable load-and-stream for tablets

And call on_internal_error if process_upload_dir
is called for tablets-enabled keyspace as it isn't
supported at the moment (maybe it could be in the future
if we make sure that the sstables are confined to tablets
boundaries).

Refs #12775
Fixes #16743

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes scylladb/scylladb#16788
This commit is contained in:
Benny Halevy
2024-01-15 18:28:50 +02:00
committed by Avi Kivity
parent 0092700ad1
commit 7a7a1db86b
2 changed files with 14 additions and 1 deletions

View File

@@ -178,6 +178,11 @@ distributed_loader::process_upload_dir(distributed<replica::database>& db, distr
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, &view_update_generator, &sys_dist_ks, ks = std::move(ks), cf = std::move(cf)] {
auto global_table = get_table_on_all_shards(db, ks, cf).get0();

View File

@@ -256,8 +256,16 @@ future<> sstables_loader::load_new_sstables(sstring ks_name, sstring cf_name,
} else {
_loading_new_sstables = true;
}
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) {
load_and_stream = true;
load_and_stream_desc = "auto-enabled-for-tablets";
}
llog.info("Loading new SSTables for keyspace={}, table={}, load_and_stream={}, primary_replica_only={}",
ks_name, cf_name, load_and_stream, primary_replica_only);
ks_name, cf_name, load_and_stream_desc, primary_replica_only);
try {
if (load_and_stream) {
::table_id table_id;