mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
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.
This commit is contained in:
parent
87d543831d
commit
519ad0f7e3
3 changed files with 26 additions and 2 deletions
|
@ -39,7 +39,12 @@ sum(n)
|
|||
show status like 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
*** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ***
|
||||
INSERT INTO t2 VALUES (2000), (2001);
|
||||
CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
|
||||
CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2;
|
||||
drop table if exists t1,t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t1'
|
||||
drop function f;
|
||||
include/rpl_end.inc
|
||||
|
|
|
@ -57,12 +57,28 @@ select count(*) from t2;
|
|||
select sum(n) from t2;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
|
||||
--echo *** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ***
|
||||
connect (master2,localhost,root,,);
|
||||
INSERT INTO t2 VALUES (2000), (2001);
|
||||
CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
|
||||
CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2;
|
||||
--let $gtid=`SELECT @@gtid_binlog_pos`
|
||||
--disconnect master2
|
||||
--connection default
|
||||
# Wait for implicit DROP TEMPORARY TABLE tmp to be binlogged.
|
||||
--let $wait_condition= SELECT @@gtid_binlog_pos != '$gtid'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
connect (master2,localhost,root,,);
|
||||
connection master2;
|
||||
drop table if exists t1,t2;
|
||||
drop function f;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue