1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-5619: CREATE OR REPLACE does not release MDL_EXCLUSIVE upon failure

mysql-test/r/create_or_replace.result:
  Added test of releasing of metadata locks
mysql-test/t/create_or_replace.test:
  Added test of releasing of metadata locks
sql/handler.h:
  Added marker if table was deleted as part of CREATE OR REPLACE
sql/sql_base.cc:
  Added Locked_tables_list::unlock_locked_table()
sql/sql_class.h:
  New prototypes
sql/sql_insert.cc:
  Unlock metadata locks for deleted table in case of error. Also do unlock tables if this was the only locked table.
sql/sql_table.cc:
  Unlock metadata locks for deleted table in case of error. Also do unlock tables if this was the only locked table.
This commit is contained in:
Michael Widenius
2014-03-12 11:26:40 +02:00
parent 49ca12a107
commit f320b12ca5
7 changed files with 157 additions and 3 deletions

View File

@ -4343,7 +4343,7 @@ void select_create::abort_result_set()
of the table succeeded or not, since we need to reset the binary
log state.
However if there was an orignal table that was deleted, as part of
However if there was an original table that was deleted, as part of
create or replace table, then we must log the statement.
*/
@ -4357,6 +4357,12 @@ void select_create::abort_result_set()
/* possible error of writing binary log is ignored deliberately */
(void) thd->binlog_flush_pending_rows_event(TRUE, TRUE);
if (create_info->table_was_deleted)
{
/* Unlock locked table that was dropped by CREATE */
thd->locked_tables_list.unlock_locked_table(thd,
create_info->mdl_ticket);
}
if (m_plock)
{
mysql_unlock_tables(thd, *m_plock);