From bc482bfdea2bdb927d66ba528e38c3190f90c4e2 Mon Sep 17 00:00:00 2001 From: Piotr Dulikowski Date: Fri, 8 May 2026 13:43:14 +0200 Subject: [PATCH] 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. Closes scylladb/scylladb#29806 --- replica/database.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replica/database.cc b/replica/database.cc index f61a5519f4..0166002464 100644 --- a/replica/database.cc +++ b/replica/database.cc @@ -1141,7 +1141,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);