1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-28956 Locking is broken if CREATE OR REPLACE fails under LOCK TABLES

add_back_last_deleted_lock() was called when the lock was never
removed. Lock is removed in finalize_atomic_replace() in
close_all_tables_for_name(). finalize_atomic_replace() is done only
for successful operation.

In non-atomic codepath it drops the table first, if anything fails
later we don't need to return back the lock since there is no table
now. So the fix is required as well.
This commit is contained in:
Aleksey Midenkov
2022-08-31 11:55:05 +03:00
parent 24fff8267d
commit a228ec80e3
7 changed files with 112 additions and 17 deletions

View File

@@ -2382,7 +2382,7 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
}
bool finalize_atomic_replace(THD *thd, TABLE_LIST *orig_table);
void finalize_ddl(THD *thd, bool roll_back);
bool finalize_locked_tables(THD *thd);
bool finalize_locked_tables(THD *thd, bool operation_failed);
bool make_tmp_table_list(THD *thd, TABLE_LIST **create_table,
int *create_table_mode);
};