mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Bug#40013 mixed replication: row based format could lead to stale tmp tables on the
slave. In mixed mode, if we create a temporary table and do some update which switch to ROW format, the format will keep in ROW format until the session ends or the table is dropped explicitly. When the session ends, the temp table is dropped automaticly at cleanup time. but it checks only current binlog format and so skip insertion of DROP TABLE instructions into binlog. So the temp table can't be dropped correctly at slave. Our solution is that when closing temp tables at cleanup time we check both binlog format and binlog mode, and we could write DROP TABLE instructions into binlog if current binlog format is ROW but in MIX mode. mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result: Test result file. mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test: Test file. sql/sql_base.cc: Didn't do binloging when both current format and default format are ROW.
This commit is contained in:
26
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
Normal file
26
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
Normal file
@ -0,0 +1,26 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
==== Initialize ====
|
||||
[on master]
|
||||
CREATE TABLE t1 (a CHAR(48));
|
||||
CREATE TEMPORARY TABLE t1_tmp1(a INT);
|
||||
INSERT INTO t1 VALUES (UUID());
|
||||
[on slave]
|
||||
==== Verify results on slave ====
|
||||
SHOW STATUS LIKE "Slave_open_temp_tables";
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 1
|
||||
[on master]
|
||||
[on slave]
|
||||
==== Verify results on slave ====
|
||||
SHOW STATUS LIKE "Slave_open_temp_tables";
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
==== Clean up ====
|
||||
[on master]
|
||||
DROP TABLE t1;
|
||||
[on slave]
|
49
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
Normal file
49
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
Normal file
@ -0,0 +1,49 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test that temporary tables are correctly replicated after switching to ROW format in MIX mode.
|
||||
# This test case will test the condition of the bug#40013.
|
||||
# The test step is:
|
||||
# 1: create temp table on connection 'master';
|
||||
# 2: switch to ROW format using 'INSERT INTO t1 VALUES (UUID());'
|
||||
# 3: disconnect 'master' and connect to a new connection 'master1';
|
||||
# 4: sync to slave and check the number of temp tables on slave.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
|
||||
--echo ==== Initialize ====
|
||||
|
||||
--echo [on master]
|
||||
--connection master
|
||||
|
||||
CREATE TABLE t1 (a CHAR(48));
|
||||
CREATE TEMPORARY TABLE t1_tmp1(a INT);
|
||||
INSERT INTO t1 VALUES (UUID());
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ==== Verify results on slave ====
|
||||
SHOW STATUS LIKE "Slave_open_temp_tables";
|
||||
|
||||
--echo [on master]
|
||||
--connection master
|
||||
|
||||
disconnect master;
|
||||
--connection master1
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ==== Verify results on slave ====
|
||||
SHOW STATUS LIKE "Slave_open_temp_tables";
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
--echo [on master]
|
||||
--connection master1
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
Reference in New Issue
Block a user