summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/r/rpl_gtid_until.result
blob: c23faecc67415e6151d768ff14eb001e5fc7573d (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
include/rpl_init.inc [topology=1->2]
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100))
RETURNS VARCHAR(100) DETERMINISTIC
BEGIN
SET s= CONCAT(",", s, ",");
SET s= SUBSTR(s FROM LOCATE(CONCAT(",", d, "-"), s) + 1);
SET s= SUBSTR(s FROM 1 FOR LOCATE(",", s) - 1);
RETURN s;
END|
START SLAVE UNTIL master_gtid_pos = "";
ERROR HY000: Slave is already running
include/stop_slave_io.inc
START SLAVE UNTIL master_gtid_pos = "";
ERROR HY000: Slave is already running
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
include/stop_slave_sql.inc
START SLAVE UNTIL master_gtid_pos = "";
ERROR HY000: Slave is already running
include/stop_slave_io.inc
START SLAVE UNTIL master_gtid_pos = "";
ERROR HY000: START SLAVE UNTIL master_gtid_pos requires that slave is using GTID
CHANGE MASTER TO master_use_gtid=current_pos;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
START SLAVE UNTIL master_gtid_pos = "0-1-100,1-1-100,2-2-200,1-3-100,4-4-400";
ERROR HY000: GTID 1-3-100 and 1-1-100 conflict (duplicate domain id 1)
START SLAVE UNTIL master_log_file = "master-bin.000001", master_log_pos = 4, master_gtid_pos = "";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'master_gtid_pos = ""' at line 1
START SLAVE IO_THREAD UNTIL master_gtid_pos = "";
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE SQL_THREAD UNTIL master_gtid_pos = "";
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL master_gtid_pos = '0-1-4';
include/wait_for_slave_to_stop.inc
SELECT * FROM t1;
a
1
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
include/stop_slave.inc
START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200,0-1-300";
include/wait_for_slave_to_start.inc
Using_Gtid = 'Current_Pos'
Until_Condition = 'Gtid'
INSERT INTO t1 VALUES (3);
DELETE FROM t1 WHERE a=3;
include/stop_slave.inc
*** Test UNTIL condition in an earlier binlog than the start GTID. ***
SET gtid_domain_id = 1;
INSERT INTO t1 VALUES (3);
SET gtid_domain_id = 2;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (3);
FLUSH LOGS;
SET gtid_domain_id = 1;
INSERT INTO t1 VALUES (4);
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (4);
FLUSH LOGS;
SET gtid_domain_id = 1;
INSERT INTO t1 VALUES (5);
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (5);
FLUSH LOGS;
SET gtid_domain_id = 1;
INSERT INTO t1 VALUES (6);
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (6);
SET gtid_domain_id = 0;
show binary logs;
Log_name	File_size
master-bin.000001	#
master-bin.000002	#
master-bin.000003	#
master-bin.000004	#
START SLAVE UNTIL master_gtid_pos='1-1-3,2-1-4';
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
SELECT * FROM t2 ORDER BY a;
a
3
4
5
START SLAVE UNTIL master_gtid_pos='1-1-4,2-1-2';
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
SELECT * FROM t2 ORDER BY a;
a
3
4
5
START SLAVE UNTIL master_gtid_pos='1-1-3';
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
SELECT * FROM t2 ORDER BY a;
a
3
4
5
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
SELECT * FROM t2 ORDER BY a;
a
3
4
5
6
*** Test when the UNTIL position is right at the end of the binlog file prior to the starting position ***
include/stop_slave.inc
FLUSH LOGS;
SET gtid_domain_id = 1;
INSERT INTO t1 VALUES (7);
SET gtid_domain_id = 0;
START SLAVE UNTIL master_gtid_pos='1-1-4';
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
7
*** Test when UNTIL condition is after a stand-alone event (not a transaction). ***
include/stop_slave.inc
CREATE TABLE t3 (a INT);
DROP TABLE t3;
START SLAVE UNTIL master_gtid_pos='UNTIL_CONDITION';
include/wait_for_slave_to_stop.inc
SHOW CREATE TABLE t3;
Table	Create Table
t3	CREATE TABLE `t3` (
  `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
include/start_slave.inc
*** Test UNTIL condition that has not yet been logged. ***
include/stop_slave.inc
RESET SLAVE ALL;
RESET MASTER;
SET GLOBAL gtid_slave_pos='';
RESET MASTER;
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
DELETE FROM t1 WHERE a >= 10;
RESET MASTER;
INSERT INTO t1 VALUES (10);
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
master_user = "root", master_use_gtid = current_pos;
START SLAVE UNTIL master_gtid_pos = '0-1-2';
include/wait_for_slave_to_start.inc
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
7
10
11
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
7
10
11
12
DROP TABLE t1;
DROP TABLE t2;
DROP FUNCTION extract_gtid;
include/rpl_end.inc