BUG#16580366- MTR TESTS FAILING SPORADICALLY ON PB2 (5.5, 5.6 AND 5.7)

DURING INNODB RECOVERY

Problem:
=======
The connection 'master' is dropped by mysqltest after
rpl_end.inc. At this point, dropping temporary tables
at the connection 'master' are not synced at slave.
So, the temporary tables replicated from master remain
on slave leading to an inconsistent close of the test.
The following test thus complains about the presence of
temporary table(s) left over from the previous test.

Fix:
===
- Put explicit drop commands in replication tests so
  that the temporary tables are dropped at slave as well.
- Added the check for Slave_open_temp_tables in
  mtr_check.sql to warn about the remaining temporary
  table, if any, at the close of a test.
This commit is contained in:
Shivji Kumar Jha 2013-09-27 01:24:16 +05:30
parent cc4043f013
commit d4011a6144
18 changed files with 47 additions and 5 deletions

View file

@ -150,10 +150,9 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
}
#
# Drops tables and synchronizes master and slave. Note that temporary
# tables are not explitcily dropped as they will be dropped while
# closing the connection.
# Drops tables and synchronizes master and slave.
#
if (`SELECT HEX(@commands) = HEX('clean')`)
{
connection master;
@ -162,10 +161,15 @@ if (`SELECT HEX(@commands) = HEX('clean')`)
DROP TABLE IF EXISTS nt_xx_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1;
--let $n= $tot_table
while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
--eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
--dec $n
}

View file

@ -112,7 +112,7 @@ FLUSH LOGS;
--echo -------- switch to master --------
connection master;
FLUSH LOGS;
DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2;
DROP DATABASE mysqltest1;
--echo End of 5.1 tests

View file

@ -38,6 +38,9 @@ reset slave;
source include/start_slave.inc;
sync_with_master;
show status like 'slave_open_temp_tables';
connection master;
drop temporary table if exists t1;
sync_slave_with_master;
#
#Bug#34654 RESET SLAVE does not clear LAST_IO_Err*

View file

@ -72,6 +72,8 @@ BEGIN
mysql.time_zone_transition_type,
mysql.user;
show status like 'slave_open_temp_tables';
END||
--

View file

@ -15,4 +15,7 @@ master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS t
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp
DROP TEMPORARY TABLE tmp;
DROP TEMPORARY TABLE tmp1;
DROP TEMPORARY TABLE tmp2;
include/rpl_end.inc

View file

@ -42,4 +42,5 @@ t5 CREATE TABLE `t5` (
`created` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2,t3,t5;
drop temporary table t4;
include/rpl_end.inc

View file

@ -1554,8 +1554,14 @@ master-bin.000001 # Query # # COMMIT
SET @commands= 'clean';
DROP TABLE IF EXISTS tt_xx_1;
DROP TABLE IF EXISTS nt_xx_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1;
DROP TABLE IF EXISTS nt_2;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
DROP TABLE IF EXISTS nt_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
DROP TABLE IF EXISTS tt_2;
DROP TABLE IF EXISTS tt_1;
SET @commands= '';

View file

@ -85,6 +85,7 @@ lock tables t3 read;
include/assert.inc [Table t3 should contain 100 lines on the slave]
unlock tables;
drop table if exists t1,t2,t3,t4;
drop temporary table temp_table;
End of 4.1 tests
show binlog events in 'non existing_binlog_file';
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log

View file

@ -1619,8 +1619,14 @@ master-bin.000001 # Query # # COMMIT
SET @commands= 'clean';
DROP TABLE IF EXISTS tt_xx_1;
DROP TABLE IF EXISTS nt_xx_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1;
DROP TABLE IF EXISTS nt_2;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
DROP TABLE IF EXISTS nt_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
DROP TABLE IF EXISTS tt_2;
DROP TABLE IF EXISTS tt_1;
SET @commands= '';

View file

@ -23,6 +23,7 @@ include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
drop temporary table if exists t1;
include/stop_slave.inc
reset slave;
include/check_slave_no_error.inc

View file

@ -48,6 +48,7 @@ select (@id := id) - id from t2;
0
kill @id;
drop table t2;
drop temporary table t3;
Got one of the listed errors
include/wait_for_slave_sql_error_and_skip.inc [errno=1053]
select count(*) from t1;

View file

@ -1604,8 +1604,14 @@ master-bin.000001 # Query # # ROLLBACK
SET @commands= 'clean';
DROP TABLE IF EXISTS tt_xx_1;
DROP TABLE IF EXISTS nt_xx_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_xx_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_xx_1;
DROP TABLE IF EXISTS nt_2;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
DROP TABLE IF EXISTS nt_1;
DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
DROP TABLE IF EXISTS tt_2;
DROP TABLE IF EXISTS tt_1;
SET @commands= '';

View file

@ -79,6 +79,7 @@ COUNT(*)
FLUSH LOGS;
-------- switch to master --------
FLUSH LOGS;
DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2;
DROP DATABASE mysqltest1;
End of 5.1 tests
#

View file

@ -23,6 +23,7 @@ include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
drop temporary table if exists t1;
include/stop_slave.inc
reset slave;
include/check_slave_no_error.inc

View file

@ -38,4 +38,8 @@ CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
source include/show_binlog_events.inc;
DROP TEMPORARY TABLE tmp;
DROP TEMPORARY TABLE tmp1;
DROP TEMPORARY TABLE tmp2;
--source include/rpl_end.inc

View file

@ -43,6 +43,7 @@ show create table t3;
show create table t5;
connection master;
drop table t2,t3,t5;
drop temporary table t4;
sync_slave_with_master;
# End of 4.1 tests

View file

@ -218,6 +218,7 @@ unlock tables;
#clean up
connection master;
drop table if exists t1,t2,t3,t4;
drop temporary table temp_table;
sync_slave_with_master;
--echo End of 4.1 tests

View file

@ -91,8 +91,8 @@ connection master1;
sleep 3;
select (@id := id) - id from t2;
kill @id;
# We don't drop t3 as this is a temporary table
drop table t2;
drop temporary table t3;
connection master;
# The get_lock function causes warning for unsafe statement.
--disable_warnings