database: add missing co_await on lock in create_local_system_table

The function database::create_local_system_table calls
get_tables_metadata().hold_write_lock(), but does not co_await the
returned future. Effectively, this code does not guarantee mutual
exclusion because it does not wait for the lock to be acquired and does
not guarantee that the lock is held long enough.

Fix this by adding the co_await that was missing.

Found by manual inspection. This code is not known to have caused any
problems so far, but it's clearly wrong - hence the fix.

Fixes: SCYLLADB-1916

Closes scylladb/scylladb#29806

(cherry picked from commit bc482bfdea)

Closes scylladb/scylladb#29815

Closes scylladb/scylladb#29833
This commit is contained in:
Piotr Dulikowski
2026-05-08 13:43:14 +02:00
parent d33fb5159a
commit 2c5ae5cee0

View File

@@ -1080,7 +1080,7 @@ future<> database::create_local_system_table(
cfg.memtable_scheduling_group = default_scheduling_group();
cfg.memtable_to_cache_scheduling_group = default_scheduling_group();
}
auto lock = get_tables_metadata().hold_write_lock();
auto lock = co_await get_tables_metadata().hold_write_lock();
std::exception_ptr ex;
try {
add_column_family(ks, table, std::move(cfg), replica::database::is_new_cf::no);