mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
BUG#54842: DROP TEMPORARY TABLE not binlogged after manual
switching binlog format to ROW BUG 52616 fixed the case which the user would switch from STMT to ROW binlog format, but the server would silently ignore it. After that fix thd->is_current_stmt_binlog_format_row() reports correct value at logging time and events are logged in ROW (as expected) instead of STMT as they were previously and wrongly logged. However, the fix was only partially complete, because on disconnect, at THD cleanup, the implicit logging of temporary tables is conditionally performed. If the binlog_format==ROW and thd->is_current_stmt_binlog_format_row() is true then DROPs are not logged. Given that the user can switch from STMT to ROW, this is wrong because the server cannot tell, just by relying on the ROW binlog format, that the tables have been dropped before. This is effectively similar to the MIXED scenario when a switch from STMT to ROW is triggered. We fix this by removing this condition from close_temporary_tables. mysql-test/extra/binlog_tests/drop_temp_table.test: Added binlog test case. mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result: Result changes because: - there is a missing drop on three temporary tables - it now contains results for the test added mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Result now contains the implicit drop for the temporary table. mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result: Result file changed because it now contains results for added test case. mysql-test/suite/rpl/r/rpl_drop_temp.result: Result file changed because it now contains results for added test case. mysql-test/suite/rpl/t/rpl_drop_temp.test: Added replication test case. sql/sql_base.cc: Removed the condition that would make the server to skip logging implicit drops when ROW binary log format mode was in use. Additionally, deployed DBUG_ENTER/RETURN macros.
This commit is contained in:
@ -26,3 +26,24 @@ CREATE TEMPORARY TABLE tmp3 (a int);
|
||||
DROP TEMPORARY TABLE tmp3;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
||||
START SLAVE;
|
||||
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;
|
||||
CREATE TABLE t1 ( i INT );
|
||||
SHOW STATUS LIKE 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
CREATE TEMPORARY TABLE ttmp1 ( i INT );
|
||||
SET SESSION binlog_format=ROW;
|
||||
SHOW STATUS LIKE 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( i INT )
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT )
|
||||
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
|
||||
DROP TABLE t1;
|
||||
|
@ -66,4 +66,32 @@ START SLAVE;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
#
|
||||
# BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW
|
||||
#
|
||||
|
||||
-- connection master
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
CREATE TABLE t1 ( i INT );
|
||||
--sync_slave_with_master
|
||||
SHOW STATUS LIKE 'Slave_open_temp_tables';
|
||||
|
||||
--connect(con1,localhost,root,,)
|
||||
CREATE TEMPORARY TABLE ttmp1 ( i INT );
|
||||
SET SESSION binlog_format=ROW;
|
||||
--disconnect con1
|
||||
|
||||
-- connection master
|
||||
--let $wait_binlog_event= DROP
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--sync_slave_with_master
|
||||
SHOW STATUS LIKE 'Slave_open_temp_tables';
|
||||
|
||||
--connection master
|
||||
--source include/show_binlog_events.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
Reference in New Issue
Block a user