From 9c79227c961d91da4d1cbd0e96a05291874d6b9c Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 8 Sep 2014 20:56:56 +0300 Subject: Fixed two bugs with CREATE OR REPLACE and LOCK TABLES: MDEV-6560 Assertion `! is_set() ' failed in Diagnostics_area::set_ok_status on killing CREATE OR REPLACE MDEV-6525 Assertion `table->pos_in_locked _tables == __null || table->pos_in_locked_tables->table = table' failed in mark_used_tables_as_free_for_reuse, locking problems and binlogging problems on CREATE OR REPLACE under lock. mysql-test/r/create_or_replace.result: Added test for MDEV-6560 mysql-test/t/create_or_replace.test: Added test for MDEV-6560 mysql-test/valgrind.supp: Added suppression for OpenSuse 12.3 sql/sql_base.cc: More DBUG sql/sql_class.cc: Changed that thd_sqlcom_can_generate_row_events() does not report that CREATE OR REPLACE is generating row events. This is safe as this function is only used by InnoDB/XtraDB to check if a query is generating row events as part of another transaction. As CREATE is always run as it's own transaction, this isn't a problem. This fixed MDEV-6525. sql/sql_table.cc: Remember if reopen_tables() generates an error (which can only happen in case of KILL). This fixed MDEV-6560 --- sql/sql_table.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5f2f1141a04..e410be4cba6 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5029,7 +5029,10 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, */ thd->locked_tables_list.add_back_last_deleted_lock(pos_in_locked_tables); if (thd->locked_tables_list.reopen_tables(thd)) + { thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); + result= 1; + } else { TABLE *table= pos_in_locked_tables->table; @@ -5292,6 +5295,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if (res) { + /* is_error() may be 0 if table existed and we generated a warning */ res= thd->is_error(); goto err; } @@ -5374,7 +5378,10 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, */ thd->locked_tables_list.add_back_last_deleted_lock(pos_in_locked_tables); if (thd->locked_tables_list.reopen_tables(thd)) + { thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); + res= 1; // We got an error + } else { /* -- cgit v1.2.1 From b2c54a9a699daa8ffd9bb500f3405dacd7eb347b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 10 Sep 2014 13:22:20 +0200 Subject: MDEV-6523 CONNECT temporary table created check_engine() was not called for assisted discovery --- sql/sql_table.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5f2f1141a04..ca1290b2753 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4372,9 +4372,6 @@ handler *mysql_create_frm_image(THD *thd, DBUG_RETURN(NULL); } - if (check_engine(thd, db, table_name, create_info)) - DBUG_RETURN(NULL); - set_table_default_charset(thd, create_info, (char*) db); db_options= create_info->table_options; @@ -4780,6 +4777,9 @@ int create_table_impl(THD *thd, THD_STAGE_INFO(thd, stage_creating_table); + if (check_engine(thd, orig_db, orig_table_name, create_info)) + goto err; + if (create_table_mode == C_ASSISTED_DISCOVERY) { /* check that it's used correctly */ -- cgit v1.2.1