1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-20091 DROP TEMPORARY table is logged despite no CREATE was logged

MDEV-5589 commit set up a policy to skip DROP TEMPORARY TABLE binary logging
in case the target table has not been "CREATEed" in binlog (no CREATE
Query-log-event was logged into the binary log).

It turns out that

1. the rule did not cover non-existing table DROPped with IF-EXISTS clause.
   The logged-create knowledge for the non-existing one does not even need
   MDEV-5589 patch, and

2. connection close disobeys it to trigger automatic DROP-IF-EXISTS
   binlogging.

Either 1 or 2 or even both is/are also responsible for unexpected binlog
records observed in MDEV-17863, actually rendering a referred
@@global.read_only irrelevant as far as the described stored procedure
definition *and* the ROW binlog-format are concerned.
This commit is contained in:
Sujatha
2019-07-23 15:46:51 +05:30
parent 0c7c61019d
commit e32f29b7f3
16 changed files with 203 additions and 93 deletions

View File

@@ -0,0 +1,54 @@
# ==== Purpose ====
#
# Test verifies that plain DROP TEMPORARY TABLE IF EXISTS statements are not
# replicated during row based replication.
#
# ==== Implementation ====
#
# Steps:
# 0 - Have a read_only master and slave. Binlog format should be "ROW".
# 1 - Create a procedure which executes DROP TEMPORARY TABLE IF EXISTS
# statements prior to CREATE TEMPORARY TABLE.
# 2 - Execute the procedure.
# 3 - Verify that the DROP TEMPORARY TABLE IF EXISTS statements within the
# procedure are not written to the binary log.
#
# ==== References ====
#
# MDEV-20091: DROP TEMPORARY table is logged despite no CREATE was logged
#
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--source include/rpl_connection_slave.inc
SET GLOBAL read_only=1;
--source include/rpl_connection_master.inc
DELIMITER |;
CREATE PROCEDURE testproc()
BEGIN
DROP TEMPORARY TABLE IF EXISTS t1_tmp;
DROP TEMPORARY TABLE IF EXISTS t2_tmp;
CREATE TEMPORARY TABLE IF NOT EXISTS t1_tmp ( t1 varchar(400) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TEMPORARY TABLE IF NOT EXISTS t2_tmp ( t2 varchar(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
END|
DELIMITER ;|
SET GLOBAL read_only=1;
CALL testproc();
--echo ******** None of the above DROP TEMPORARY TABLE statement should be found in binary log ********
--source include/show_binlog_events.inc
--sync_slave_with_master
SELECT @@read_only;
--echo ======== CLEAN UP =========
--source include/rpl_connection_master.inc
DROP TEMPORARY TABLE t1_tmp;
DROP TEMPORARY TABLE t2_tmp;
DROP PROCEDURE testproc;
SET GLOBAL read_only=0;
--sync_slave_with_master
SET GLOBAL read_only=0;
--source include/rpl_end.inc