| 1 |
--source include/master-slave.inc |
| 2 |
|
| 3 |
--echo *** MDEV-6403: Temporary tables lost at STOP SLAVE in GTID mode if master has not rotated binlog since restart *** |
| 4 |
|
| 5 |
--connection master |
| 6 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 7 |
--sync_slave_with_master |
| 8 |
|
| 9 |
--connection slave |
| 10 |
--source include/stop_slave.inc |
| 11 |
# Inject a duplicate key error that will make the slave stop in the middle of |
| 12 |
# a sequence of transactions that use a temporary table. |
| 13 |
SET sql_log_bin= 0; |
| 14 |
INSERT INTO t1 VALUES (1); |
| 15 |
SET sql_log_bin= 1; |
| 16 |
|
| 17 |
--connection master |
| 18 |
|
| 19 |
# Make some queries that use a temporary table. |
| 20 |
CREATE TEMPORARY TABLE t2 LIKE t1; |
| 21 |
INSERT INTO t2 VALUE (1); |
| 22 |
INSERT INTO t1 SELECT * FROM t2; |
| 23 |
DROP TEMPORARY TABLE t2; |
| 24 |
--save_master_pos |
| 25 |
|
| 26 |
--connection slave |
| 27 |
START SLAVE; |
| 28 |
--let $slave_sql_errno=1062 |
| 29 |
--source include/wait_for_slave_sql_error.inc |
| 30 |
|
| 31 |
# Restart the slave. |
| 32 |
# The bug was that the IO thread would receive again the restart |
| 33 |
# format_description event at the start of the master's binlog, and this |
| 34 |
# event would cause the SQL thread to discard all active temporary tables. |
| 35 |
|
| 36 |
STOP SLAVE IO_THREAD; |
| 37 |
|
| 38 |
SET sql_log_bin= 0; |
| 39 |
DELETE FROM t1 WHERE a=1; |
| 40 |
SET sql_log_bin= 1; |
| 41 |
|
| 42 |
--source include/start_slave.inc |
| 43 |
--sync_with_master |
| 44 |
SELECT * FROM t1 ORDER BY a; |
| 45 |
|
| 46 |
--connection master |
| 47 |
DROP TABLE t1; |
| 48 |
|
| 49 |
--source include/rpl_end.inc |