diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2015-04-20 12:59:46 +0200 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2015-04-20 12:59:46 +0200 |
commit | 519ad0f7e35ff4dd13aac3c13da44c649f724352 (patch) | |
tree | f266f58311df361b88ad35a87a04a2c9c520f211 /sql/sql_base.cc | |
parent | 87d543831d2d1f89fd5b122de24591f9d9b91d13 (diff) | |
download | mariadb-git-519ad0f7e35ff4dd13aac3c13da44c649f724352.tar.gz |
MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS
This was a regression from the patch for MDEV-7668.
A test was incorrect, so the slave would not properly handle re-using
temporary tables, which lead to replication failure in this case.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 244791da23f..f337b3b6283 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -653,6 +653,7 @@ bool close_cached_connection_tables(THD *thd, LEX_STRING *connection) static void mark_temp_tables_as_free_for_reuse(THD *thd) { + rpl_group_info *rgi_slave; DBUG_ENTER("mark_temp_tables_as_free_for_reuse"); if (thd->query_id == 0) @@ -661,7 +662,9 @@ static void mark_temp_tables_as_free_for_reuse(THD *thd) DBUG_VOID_RETURN; } - if (thd->temporary_tables) + rgi_slave=thd->rgi_slave; + if ((!rgi_slave && thd->temporary_tables) || + (rgi_slave && unlikely(rgi_slave->rli->save_temporary_tables))) { thd->lock_temporary_tables(); for (TABLE *table= thd->temporary_tables ; table ; table= table->next) @@ -670,7 +673,7 @@ static void mark_temp_tables_as_free_for_reuse(THD *thd) mark_tmp_table_for_reuse(table); } thd->unlock_temporary_tables(); - if (thd->rgi_slave) + if (rgi_slave) { /* Temporary tables are shared with other by sql execution threads. |