summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/r/rpl_stop_slave.result
blob: 4e16e8264f66a9a8d91d3563b34947f23cb1538f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;

# BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
#
# If a temporary table is created or dropped, the transaction should be
# regarded similarly that a non-transactional table is modified. So 
# STOP SLAVE should wait until the transaction has finished.
CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
SET DEBUG_SYNC= 'RESET';
include/stop_slave.inc

# Suspend the INSERT statement in current transaction on SQL thread.
# It guarantees that SQL thread is applying the transaction when
# STOP SLAVE command launchs.
SET GLOBAL debug= 'd,after_mysql_insert';
include/start_slave.inc

# CREATE TEMPORARY TABLE with InnoDB engine
# -----------------------------------------

[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;

[ On Slave ]
STOP SLAVE SQL_THREAD;

[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
SET DEBUG_SYNC= 'RESET';

[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;

# CREATE TEMPORARY TABLE with MyISAM engine
# -----------------------------------------

[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;

[ On Slave ]
STOP SLAVE SQL_THREAD;

[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
SET DEBUG_SYNC= 'RESET';

[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;

# CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
# ----------------------------------------------------

[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
SELECT c1 FROM t2;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;

[ On Slave ]
STOP SLAVE SQL_THREAD;

[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
SET DEBUG_SYNC= 'RESET';

[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;

# CREATE TEMPORARY TABLE ... SELECT with MyISAM engine
# ----------------------------------------------------

[ On Master ]
BEGIN;
DELETE FROM t1;
CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM
SELECT 1 AS c1;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;

[ On Slave ]
STOP SLAVE SQL_THREAD;

[ On Slave1 ]
# To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
SET DEBUG_SYNC= 'RESET';

[ On Slave ]
# Slave should stop after the transaction has committed.
# So t1 on master is same to t1 on slave.
Comparing tables master:test.t1 and slave:test.t1
START SLAVE SQL_THREAD;
# Test end
SET GLOBAL debug= '$debug_save';
DROP TABLE t1, t2;