Debian Codegraph @

mysql-test/suite/rpl/r/rpl_stop_slave.result

raw
1 include/master-slave.inc
2 [connection master]
3 connection slave;
4 include/stop_slave.inc
5 CHANGE MASTER TO MASTER_USE_GTID=NO;
6 include/start_slave.inc
7 connection master;
8
9 # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
10 #
11 # If a temporary table is created or dropped, the transaction should be
12 # regarded similarly that a non-transactional table is modified. So
13 # STOP SLAVE should wait until the transaction has finished.
14 CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
15 CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
16 connection slave;
17 SET DEBUG_SYNC= 'RESET';
18 include/stop_slave.inc
19
20 # Suspend the INSERT statement in current transaction on SQL thread.
21 # It guarantees that SQL thread is applying the transaction when
22 # STOP SLAVE command launchs.
23 SET @saved_dbug = @@GLOBAL.debug_dbug;
24 set global debug_dbug= '+d,after_mysql_insert';
25 include/start_slave.inc
26
27 # CREATE TEMPORARY TABLE with InnoDB engine
28 # -----------------------------------------
29 connection master;
30 BEGIN;
31 DELETE FROM t1;
32 CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
33 INSERT INTO t1 VALUES (1);
34 DROP TEMPORARY TABLE tt1;
35 COMMIT;
36 connection slave;
37 STOP SLAVE SQL_THREAD;
38 connection slave1;
39 # To resume slave SQL thread
40 SET DEBUG_SYNC= 'now SIGNAL signal.continue';
41 SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
42 SET DEBUG_SYNC= 'RESET';
43 connection slave;
44 include/wait_for_slave_sql_to_stop.inc
45 # Slave should stop after the transaction has committed.
46 # So t1 on master is same to t1 on slave.
47 include/diff_tables.inc [master:t1, slave:t1]
48 connection slave;
49 START SLAVE SQL_THREAD;
50 include/wait_for_slave_sql_to_start.inc
51 connection master;
52 connection slave;
53
54 # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
55 # ----------------------------------------------------
56 connection master;
57 BEGIN;
58 DELETE FROM t1;
59 CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
60 SELECT c1 FROM t2;
61 INSERT INTO t1 VALUES (1);
62 DROP TEMPORARY TABLE tt1;
63 COMMIT;
64 connection slave;
65 STOP SLAVE SQL_THREAD;
66 connection slave1;
67 # To resume slave SQL thread
68 SET DEBUG_SYNC= 'now SIGNAL signal.continue';
69 SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
70 SET DEBUG_SYNC= 'RESET';
71 connection slave;
72 include/wait_for_slave_sql_to_stop.inc
73 # Slave should stop after the transaction has committed.
74 # So t1 on master is same to t1 on slave.
75 include/diff_tables.inc [master:t1, slave:t1]
76 connection slave;
77 START SLAVE SQL_THREAD;
78 include/wait_for_slave_sql_to_start.inc
79 connection master;
80 connection slave;
81
82 # Test end
83 SET @@GLOBAL.debug_dbug = @saved_dbug;
84 include/restart_slave.inc
85 connection slave;
86 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");
87 connection master;
88 DROP TABLE t1, t2;
89
90 # Bug#58546 test rpl_packet timeout failure sporadically on PB
91 # ----------------------------------------------------------------------
92 # STOP SLAVE stopped IO thread first and then stopped SQL thread. It was
93 # possible that IO thread stopped after replicating part of a transaction
94 # which SQL thread was executing. SQL thread would be hung if the
95 # transaction could not be rolled back safely.
96 # It caused some sporadic failures on PB2.
97 #
98 # This test verifies that when 'STOP SLAVE' is issued by a user, IO
99 # thread will continue to fetch the rest events of the transaction which
100 # is being executed by SQL thread and is not able to be rolled back safely.
101 CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
102 CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
103 INSERT INTO t1 VALUES(1, 1);
104 connection slave;
105 include/stop_slave.inc
106 connection master;
107 include/stop_dump_threads.inc
108 SET @saved_dbug = @@GLOBAL.debug_dbug;
109 set global debug_dbug= '+d,dump_thread_wait_before_send_xid';
110 connection slave;
111 include/start_slave.inc
112 BEGIN;
113 UPDATE t1 SET c2 = 2 WHERE c1 = 1;
114 connection master;
115 BEGIN;
116 INSERT INTO t1 VALUES(2, 2);
117 INSERT INTO t2 VALUES(1);
118 UPDATE t1 SET c2 = 3 WHERE c1 = 1;
119 COMMIT;
120 connection slave1;
121 STOP SLAVE;
122 connection slave;
123 ROLLBACK;
124 connection master;
125 SET DEBUG_SYNC= 'now SIGNAL signal.continue';
126 SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
127 connection slave;
128 include/wait_for_slave_to_stop.inc
129 connection slave1;
130 connection master;
131 SET @@GLOBAL.debug_dbug = @saved_dbug;
132 include/stop_dump_threads.inc
133 connection slave1;
134 include/start_slave.inc
135 connection master;
136 DROP TABLE t1, t2;
137 include/rpl_end.inc
138 SET DEBUG_SYNC= 'RESET';