From 2c5ae5cee04815364be18be07fb7e17b55b8a91c 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. Fixes: SCYLLADB-1916 Closes scylladb/scylladb#29806 (cherry picked from commit bc482bfdea2bdb927d66ba528e38c3190f90c4e2) Closes scylladb/scylladb#29815 Closes scylladb/scylladb#29833 --- replica/database.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replica/database.cc b/replica/database.cc index 0f30ffbb72..d67d531b75 100644 --- a/replica/database.cc +++ b/replica/database.cc @@ -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);