Skip to content

Commit

Permalink
MDEV-20188: binlog.binlog_stm_drop_tmp_tbl fails in buildbot with Unk…
Browse files Browse the repository at this point in the history
…nown 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.
  • Loading branch information
sujatha-s committed Aug 26, 2019
1 parent b01a95f commit 4a9fb90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions mysql-test/extra/binlog_tests/drop_temp_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4a9fb90

Please sign in to comment.