| 1 |
source include/have_innodb.inc; |
| 2 |
source include/have_debug.inc; |
| 3 |
source include/have_debug_sync.inc; |
| 4 |
source include/have_binlog_format_mixed_or_statement.inc; |
| 5 |
source include/master-slave.inc; |
| 6 |
|
| 7 |
--connection slave |
| 8 |
--source include/stop_slave.inc |
| 9 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 10 |
--source include/start_slave.inc |
| 11 |
--connection master |
| 12 |
|
| 13 |
--echo |
| 14 |
--echo # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends |
| 15 |
--echo # |
| 16 |
--echo # If a temporary table is created or dropped, the transaction should be |
| 17 |
--echo # regarded similarly that a non-transactional table is modified. So |
| 18 |
--echo # STOP SLAVE should wait until the transaction has finished. |
| 19 |
|
| 20 |
CREATE TABLE t1(c1 INT) ENGINE=InnoDB; |
| 21 |
CREATE TABLE t2(c1 INT) ENGINE=InnoDB; |
| 22 |
|
| 23 |
sync_slave_with_master; |
| 24 |
SET DEBUG_SYNC= 'RESET'; |
| 25 |
source include/stop_slave.inc; |
| 26 |
|
| 27 |
--echo |
| 28 |
--echo # Suspend the INSERT statement in current transaction on SQL thread. |
| 29 |
--echo # It guarantees that SQL thread is applying the transaction when |
| 30 |
--echo # STOP SLAVE command launchs. |
| 31 |
SET @saved_dbug = @@GLOBAL.debug_dbug; |
| 32 |
set global debug_dbug= '+d,after_mysql_insert'; |
| 33 |
source include/start_slave.inc; |
| 34 |
|
| 35 |
--echo |
| 36 |
--echo # CREATE TEMPORARY TABLE with InnoDB engine |
| 37 |
--echo # ----------------------------------------- |
| 38 |
let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB; |
| 39 |
source include/rpl_stop_slave.test; |
| 40 |
|
| 41 |
--echo |
| 42 |
--echo # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine |
| 43 |
--echo # ---------------------------------------------------- |
| 44 |
let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB |
| 45 |
SELECT c1 FROM t2; |
| 46 |
source include/rpl_stop_slave.test; |
| 47 |
|
| 48 |
# Don't need to verify 'CREATE TEMPORARY TABLE' with MyIASM engine, as it |
| 49 |
# never is binlogged into a transaction since 5.5. |
| 50 |
|
| 51 |
--echo |
| 52 |
--echo # Test end |
| 53 |
SET @@GLOBAL.debug_dbug = @saved_dbug; |
| 54 |
source include/restart_slave_sql.inc; |
| 55 |
|
| 56 |
connection slave; |
| 57 |
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); |
| 58 |
connection master; |
| 59 |
|
| 60 |
DROP TABLE t1, t2; |
| 61 |
|
| 62 |
--echo |
| 63 |
--echo # Bug#58546 test rpl_packet timeout failure sporadically on PB |
| 64 |
--echo # ---------------------------------------------------------------------- |
| 65 |
--echo # STOP SLAVE stopped IO thread first and then stopped SQL thread. It was |
| 66 |
--echo # possible that IO thread stopped after replicating part of a transaction |
| 67 |
--echo # which SQL thread was executing. SQL thread would be hung if the |
| 68 |
--echo # transaction could not be rolled back safely. |
| 69 |
--echo # It caused some sporadic failures on PB2. |
| 70 |
--echo # |
| 71 |
--echo # This test verifies that when 'STOP SLAVE' is issued by a user, IO |
| 72 |
--echo # thread will continue to fetch the rest events of the transaction which |
| 73 |
--echo # is being executed by SQL thread and is not able to be rolled back safely. |
| 74 |
|
| 75 |
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB; |
| 76 |
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; |
| 77 |
INSERT INTO t1 VALUES(1, 1); |
| 78 |
|
| 79 |
sync_slave_with_master; |
| 80 |
--source include/stop_slave.inc |
| 81 |
|
| 82 |
connection master; |
| 83 |
# make sure that there are no zombie threads |
| 84 |
--source include/stop_dump_threads.inc |
| 85 |
|
| 86 |
SET @saved_dbug = @@GLOBAL.debug_dbug; |
| 87 |
set global debug_dbug= '+d,dump_thread_wait_before_send_xid'; |
| 88 |
|
| 89 |
connection slave; |
| 90 |
--source include/start_slave.inc |
| 91 |
|
| 92 |
BEGIN; |
| 93 |
UPDATE t1 SET c2 = 2 WHERE c1 = 1; |
| 94 |
|
| 95 |
connection master; |
| 96 |
BEGIN; |
| 97 |
INSERT INTO t1 VALUES(2, 2); |
| 98 |
INSERT INTO t2 VALUES(1); |
| 99 |
UPDATE t1 SET c2 = 3 WHERE c1 = 1; |
| 100 |
COMMIT; |
| 101 |
|
| 102 |
# wait for the dump thread reach the sync point |
| 103 |
--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%debug sync point%' and command='Binlog Dump' |
| 104 |
--source include/wait_condition.inc |
| 105 |
|
| 106 |
connection slave1; |
| 107 |
let $show_statement= SHOW PROCESSLIST; |
| 108 |
let $field= Info; |
| 109 |
let $condition= = 'UPDATE t1 SET c2 = 3 WHERE c1 = 1'; |
| 110 |
source include/wait_show_condition.inc; |
| 111 |
|
| 112 |
send STOP SLAVE; |
| 113 |
|
| 114 |
connection slave; |
| 115 |
ROLLBACK; |
| 116 |
|
| 117 |
connection master; |
| 118 |
|
| 119 |
SET DEBUG_SYNC= 'now SIGNAL signal.continue'; |
| 120 |
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued'; |
| 121 |
|
| 122 |
connection slave; |
| 123 |
source include/wait_for_slave_to_stop.inc; |
| 124 |
|
| 125 |
connection slave1; |
| 126 |
reap; |
| 127 |
|
| 128 |
# Slave has stopped, thence lets make sure that |
| 129 |
# we kill the zombie dump threads. Also, make |
| 130 |
# sure that we disable the DBUG_EXECUTE_IF |
| 131 |
# that would set the dump thread to wait |
| 132 |
connection master; |
| 133 |
SET @@GLOBAL.debug_dbug = @saved_dbug; |
| 134 |
# make sure that there are no zombie threads |
| 135 |
--source include/stop_dump_threads.inc |
| 136 |
|
| 137 |
connection slave1; |
| 138 |
# now the dump thread on the master will start |
| 139 |
# from a clean slate, i.e. without the |
| 140 |
# DBUG_EXECUTE_IF set |
| 141 |
source include/start_slave.inc; |
| 142 |
|
| 143 |
connection master; |
| 144 |
DROP TABLE t1, t2; |
| 145 |
--source include/rpl_end.inc |
| 146 |
SET DEBUG_SYNC= 'RESET'; |