Commit 4a9fb905 authored by Sujatha's avatar Sujatha

MDEV-20188: binlog.binlog_stm_drop_tmp_tbl fails in buildbot with Unknown table on exec

Analysis:
========
As part of BUG#28642318 fix, two new test cases were added. The first test
case tests a scenario where two sessions are present, in which the first
session has a regular table named 't1' and another session has a temporary
table named 't1'. Test executes a DELETE statement on regular table. These
statements are captured from binary log and replayed back on new client
connection to prove that DELETE statement is applied successfully. Note that
the binlog contains only CREATE TEMPORARY TABLE part hence a temporary table
gets created in new connection. This replaying logic is implemented by using
'--exec $MYSQL' command. If the new connection gets disconnected within the
scope of first test case the test passes, i.e the temporary table gets dropped
as part thread cleanup. But on slow platforms the connection gets closed at
the time of execution of test case 2. When the temporary table is dropped as
part thread cleanup a "DROP TEMPORARY TABLE t1" is written into the binary
log. In test case two the same sessions continue to exist and and table names
are reused to test a new bug scenario. The additional "DROP TEMPORARY TABLE"
command drops second test specific tables which results in "Unknown table"
error.

Fix:
====
Rename the second case specific table to 't2'. Even if the close connection
from test case one happens later the drop command with has
'DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`' will not result in an error.
parent b01a95f6
......@@ -150,16 +150,16 @@ RESET MASTER;
--echo # Test case for DROP query.
--connection default
CREATE TABLE t1 (a INT) ENGINE=INNODB;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
--connection con1
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
--connection default
DROP TABLE t1;
DROP TABLE t2;
--connection con1
DROP TABLE t1;
DROP TABLE t2;
--connection default
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug28642318.sql
......
......@@ -71,10 +71,10 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET MASTER;
# Test case for DROP query.
CREATE TABLE t1 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
DROP TABLE t2;
DROP TABLE t2;
# DROP table query fails with unknown table error without patch.
# Clean up
SET @@session.binlog_format= @save_binlog_format;
......
......@@ -99,10 +99,10 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET MASTER;
# Test case for DROP query.
CREATE TABLE t1 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
DROP TABLE t2;
DROP TABLE t2;
# DROP table query fails with unknown table error without patch.
# Clean up
SET @@session.binlog_format= @save_binlog_format;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment