Description:
When binlog is running with stmt format and semi sync plugin is instlled, the binlog query event "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS" will miss after close a connection.
This bug is included by WL#14585 in 8.0.29,an unexpected error returned during run hook Trans_delegate::before_commit.
This bug may case replication interrupt and data inconsistent.
How to repeat:
--source include/have_binlog_format_statement.inc
install plugin rpl_semi_sync_master soname 'semisync_master.so';
install plugin rpl_semi_sync_slave soname 'semisync_slave.so';
RESET MASTER;
CREATE TABLE t1(a INT) ENGINE=InnoDB;
--source include/count_sessions.inc
--connect(con1,localhost,root)
# A DROP should be logged for the following tables because CREATE TABLE
# is logged
CREATE TEMPORARY TABLE tmp1 ENGINE=InnoDB SELECT * FROM t1;
CREATE TEMPORARY TABLE tmp5 (a INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE tmp7 LIKE t1;
--disconnect con1
--connection default
--source include/wait_until_count_sessions.inc
--source include/show_binlog_events.inc
# Expect result of show binlog events
binlog.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1 ENGINE=InnoDB SELECT * FROM t1
binlog.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp5 (a INT) ENGINE=InnoDB
binlog.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp7 LIKE t1
-binlog.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `tmp7`,`tmp5`,`tmp1`
# The real execution result of show binlog events
binlog.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1 ENGINE=InnoDB SELECT * FROM t1
binlog.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp5 (a INT) ENGINE=InnoDB
binlog.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp7 LIKE t1
Suggested fix:
Add more condition for conditional statement Trans_delegate::before_commit,to avoid affect DROP TEMPORARY TABLE query event.