mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
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
This commit is contained in:
committed by
Avi Kivity
parent
5a887362e3
commit
bc482bfdea
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user