1
include/master-slave.inc
4
# BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
6
# If a temporary table is created or dropped, the transaction should be
7
# regarded similarly that a non-transactional table is modified. So
8
# STOP SLAVE should wait until the transaction has finished.
9
CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
10
CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
11
SET DEBUG_SYNC= 'RESET';
12
include/stop_slave.inc
14
# Suspend the INSERT statement in current transaction on SQL thread.
15
# It guarantees that SQL thread is applying the transaction when
16
# STOP SLAVE command launchs.
17
SET GLOBAL debug= 'd,after_mysql_insert';
18
include/start_slave.inc
20
# CREATE TEMPORARY TABLE with InnoDB engine
21
# -----------------------------------------
26
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
27
INSERT INTO t1 VALUES (1);
28
DROP TEMPORARY TABLE tt1;
32
STOP SLAVE SQL_THREAD;
35
# To resume slave SQL thread
36
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
37
SET DEBUG_SYNC= 'RESET';
40
include/wait_for_slave_sql_to_stop.inc
41
# Slave should stop after the transaction has committed.
42
# So t1 on master is same to t1 on slave.
43
include/diff_tables.inc [master:t1, slave:t1]
44
START SLAVE SQL_THREAD;
45
include/wait_for_slave_sql_to_start.inc
47
# CREATE TEMPORARY TABLE with MyISAM engine
48
# -----------------------------------------
53
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM;
54
INSERT INTO t1 VALUES (1);
55
DROP TEMPORARY TABLE tt1;
59
STOP SLAVE SQL_THREAD;
62
# To resume slave SQL thread
63
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
64
SET DEBUG_SYNC= 'RESET';
67
include/wait_for_slave_sql_to_stop.inc
68
# Slave should stop after the transaction has committed.
69
# So t1 on master is same to t1 on slave.
70
include/diff_tables.inc [master:t1, slave:t1]
71
START SLAVE SQL_THREAD;
72
include/wait_for_slave_sql_to_start.inc
74
# CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
75
# ----------------------------------------------------
80
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
82
INSERT INTO t1 VALUES (1);
83
DROP TEMPORARY TABLE tt1;
87
STOP SLAVE SQL_THREAD;
90
# To resume slave SQL thread
91
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
92
SET DEBUG_SYNC= 'RESET';
95
include/wait_for_slave_sql_to_stop.inc
96
# Slave should stop after the transaction has committed.
97
# So t1 on master is same to t1 on slave.
98
include/diff_tables.inc [master:t1, slave:t1]
99
START SLAVE SQL_THREAD;
100
include/wait_for_slave_sql_to_start.inc
102
# CREATE TEMPORARY TABLE ... SELECT with MyISAM engine
103
# ----------------------------------------------------
108
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM
110
INSERT INTO t1 VALUES (1);
111
DROP TEMPORARY TABLE tt1;
115
STOP SLAVE SQL_THREAD;
118
# To resume slave SQL thread
119
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
120
SET DEBUG_SYNC= 'RESET';
123
include/wait_for_slave_sql_to_stop.inc
124
# Slave should stop after the transaction has committed.
125
# So t1 on master is same to t1 on slave.
126
include/diff_tables.inc [master:t1, slave:t1]
127
START SLAVE SQL_THREAD;
128
include/wait_for_slave_sql_to_start.inc
130
SET GLOBAL debug= '$debug_save';
131
include/restart_slave.inc
135
# Bug#58546 test rpl_packet timeout failure sporadically on PB
136
# ----------------------------------------------------------------------
137
# STOP SLAVE stopped IO thread first and then stopped SQL thread. It was
138
# possible that IO thread stopped after replicating part of a transaction
139
# which SQL thread was executing. SQL thread would be hung if the
140
# transaction could not be rolled back safely.
141
# It caused some sporadic failures on PB2.
143
# This test verifies that when 'STOP SLAVE' is issued by a user, IO
144
# thread will continue to fetch the rest events of the transaction which
145
# is being executed by SQL thread and is not able to be rolled back safely.
146
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
147
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
148
INSERT INTO t1 VALUES(1, 1);
150
SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid';
152
include/restart_slave.inc
154
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
157
INSERT INTO t1 VALUES(2, 2);
158
INSERT INTO t2 VALUES(1);
159
UPDATE t1 SET c2 = 3 WHERE c1 = 1;
166
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
167
SET DEBUG_SYNC= 'RESET';
169
include/wait_for_slave_to_stop.inc
171
include/start_slave.inc
174
SET GLOBAL debug= $debug_save;