summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2014-03-19 15:15:57 +0200
committerMichael Widenius <monty@mariadb.org>2014-03-19 15:15:57 +0200
commit913d1f199c1e21edef4c373a29eef22aa2bc71ed (patch)
treedd30140c7fb3211acac29485740320dfd7b1a6bf /sql/sql_base.cc
parente7704bfdd6bf1be96026a708243aa33069246a99 (diff)
downloadmariadb-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_base.cc')
-rw-r--r--sql/sql_base.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index bb15562b8f8..918da90e875 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -656,6 +656,12 @@ static void mark_temp_tables_as_free_for_reuse(THD *thd)
{
DBUG_ENTER("mark_temp_tables_as_free_for_reuse");
+ if (thd->query_id == 0)
+ {
+ /* Thread has not executed any statement and has not used any tmp tables */
+ DBUG_VOID_RETURN;
+ }
+
thd->lock_temporary_tables();
for (TABLE *table= thd->temporary_tables ; table ; table= table->next)
{