diff options
author | Michael Widenius <monty@mariadb.org> | 2014-03-19 15:15:57 +0200 |
---|---|---|
committer | Michael Widenius <monty@mariadb.org> | 2014-03-19 15:15:57 +0200 |
commit | 913d1f199c1e21edef4c373a29eef22aa2bc71ed (patch) | |
tree | dd30140c7fb3211acac29485740320dfd7b1a6bf /sql/sql_table.cc | |
parent | e7704bfdd6bf1be96026a708243aa33069246a99 (diff) | |
download | mariadb-git-913d1f199c1e21edef4c373a29eef22aa2bc71ed.tar.gz |
MDEV-5854 Interrupted CREATE OR REPLACE is written into binlog, and in a wrong format
mysql-test/r/create_or_replace2.result:
Added test case
mysql-test/t/create_or_replace.test:
Fixed comment
mysql-test/t/create_or_replace2.test:
Added test case
sql/sql_base.cc:
Safety fix:
Don't let threads with query_id=0 free temporary tables as this may free temporary tables not in use.
This is mostly the case for the slave io threads, as most other threads has thd->query_id != 0.
sql/sql_table.cc:
Added comment.
Ignore kill when opening temporary table for CREATE ... LIKE.
This fixed the original isue
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bee2ad64626..8e9601c437e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2560,6 +2560,18 @@ err: error= 1; } + /* + We are always logging drop of temporary tables. + The reason is to handle the following case: + - Use statement based replication + - CREATE TEMPORARY TABLE foo (logged) + - set row based replication + - DROP TEMPORAY TABLE foo (needs to be logged) + This should be fixed so that we remember if creation of the + temporary table was logged and only log it if the creation was + logged. + */ + if (non_trans_tmp_table_deleted || trans_tmp_table_deleted || non_tmp_table_deleted) { @@ -4628,6 +4640,7 @@ int create_table_impl(THD *thd, thd->variables.option_bits|= OPTION_KEEP_LOG; thd->log_current_statement= 1; create_info->table_was_deleted= 1; + DBUG_EXECUTE_IF("send_kill_after_delete", thd->killed= KILL_QUERY; ); /* The test of query_tables is to ensure we have any tables in the @@ -4769,6 +4782,7 @@ int create_table_impl(THD *thd, err: THD_STAGE_INFO(thd, stage_after_create); delete file; + DBUG_PRINT("exit", ("return: %d", error)); DBUG_RETURN(error); warn: @@ -5262,7 +5276,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, char buf[2048]; String query(buf, sizeof(buf), system_charset_info); query.length(0); // Have to zero it since constructor doesn't - Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN); + Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN | + MYSQL_OPEN_IGNORE_KILLED); bool new_table= FALSE; // Whether newly created table is open. if (create_res != 0) @@ -5271,6 +5286,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, Table or view with same name already existed and we where using IF EXISTS. Continue without logging anything. */ + do_logging= 0; goto err; } if (!table->table) @@ -5316,6 +5332,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if (write_bin_log(thd, TRUE, query.ptr(), query.length())) { res= 1; + do_logging= 0; goto err; } |