mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#5370 Keep forward-compatibility when changing
'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour BUG#47132, BUG#47442, BUG49494, BUG#23992 and BUG#48814 will disappear automatically after the this patch. BUG#55617 is fixed by this patch too. This is the 5.5 part. It implements: - 'CREATE TABLE IF NOT EXISTS ... SELECT' statement will not insert anything and binlog anything if the table already exists. It only generate a warning that table already exists. - A couple of test cases for the behavior changing.
This commit is contained in:
@ -2540,10 +2540,6 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
|
||||
is never opened. In both cases, metadata locks are always taken according
|
||||
to the lock strategy.
|
||||
|
||||
If the lock strategy is OTLS_DOWNGRADE_IF_EXISTS and opening the table
|
||||
is successful, the exclusive metadata lock acquired by the caller
|
||||
is downgraded to a shared lock.
|
||||
|
||||
RETURN
|
||||
TRUE Open failed. "action" parameter may contain type of action
|
||||
needed to remedy problem before retrying again.
|
||||
@ -2952,15 +2948,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
|
||||
mysql_mutex_unlock(&LOCK_open);
|
||||
|
||||
/*
|
||||
In CREATE TABLE .. If NOT EXISTS .. SELECT we have found that
|
||||
table exists now we should downgrade our exclusive metadata
|
||||
lock on this table to SW metadata lock.
|
||||
*/
|
||||
if (table_list->lock_strategy == TABLE_LIST::OTLS_DOWNGRADE_IF_EXISTS &&
|
||||
!(flags & MYSQL_OPEN_HAS_MDL_LOCK))
|
||||
mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_WRITE);
|
||||
|
||||
table->mdl_ticket= mdl_ticket;
|
||||
|
||||
table->next= thd->open_tables; /* Link into simple list */
|
||||
|
Reference in New Issue
Block a user