Debian Codegraph @

mysql-test/suite/rpl/r/rpl_gtid_index.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= slave_pos;
6 include/start_slave.inc
7 connection master;
8 CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
9 INSERT INTO t1 VALUES (0, 0);
10 *** Test looking up a lot of different event positions and GTIDs.
11 CREATE FUNCTION gtid_eq(a VARCHAR(255), b VARCHAR(255)) RETURNS BOOLEAN DETERMINISTIC
12 BEGIN
13 DECLARE g VARCHAR(255);
14 IF a IS NULL OR b IS NULL OR LENGTH(a) != LENGTH(b) THEN
15 RETURN FALSE;
16 END IF;
17 SET a= CONCAT(a, ',');
18 SET b= CONCAT(',', b, ',');
19 WHILE LENGTH(a) > 0 DO
20 SET g= REGEXP_SUBSTR(a, '^[^,]+,');
21 SET a= SUBSTRING(a, LENGTH(g)+1);
22 SET b= REPLACE(b, CONCAT(',', g), ',');
23 END WHILE;
24 RETURN b = ',';
25 END //
26 SET @old_page_size= @@GLOBAL.binlog_gtid_index_page_size;
27 SET @old_span_min= @@GLOBAL.binlog_gtid_index_span_min;
28 *** A fair amount of work with default GTID index settings.
29 *** Testing 200 GTIDs with 50 test connects
30 connection master;
31 DELETE FROM t1 WHERE a >= 1000;
32 FLUSH NO_WRITE_TO_BINLOG BINARY LOGS;
33 CREATE TABLE rand_data(idx INT PRIMARY KEY, domain_id INT, server_id INT)
34 ENGINE=InnoDB;
35 INSERT INTO rand_data(idx, domain_id, server_id) VALUES (0, 0, 1);
36 INSERT INTO rand_data(idx, domain_id, server_id)
37 SELECT seq,
38 @tmp:=floor(5*POW(rand(42),2)),
39 100 + 5*@tmp + floor(5*rand(42))
40 FROM seq_1_to_200;
41 SELECT COUNT(*), SUM(domain_id), SUM(server_id) FROM rand_data;
42 COUNT(*) SUM(domain_id) SUM(server_id)
43 201 285 21852
44 CREATE TABLE gtid_data(
45 idx INT PRIMARY KEY,
46 gtid VARCHAR(44),
47 gtid_pos VARCHAR(255),
48 file VARCHAR(100),
49 pos INT,
50 row_count INT,
51 KEY(file, pos)) ENGINE=InnoDB;
52 include/save_master_gtid.inc
53 connection slave;
54 include/sync_with_master_gtid.inc
55 include/stop_slave.inc
56 connection master;
57 SET @orig_domain_id= @@gtid_domain_id;
58 SET @orig_server_id= @@server_id;
59 SET gtid_domain_id= @orig_domain_id;
60 SET server_id= @orig_server_id;
61 SELECT COUNT(*) FROM gtid_data;
62 COUNT(*)
63 200
64 *** The result should be empty, otherwise some result is wrong:
65 SELECT idx, gtid_pos, BINLOG_GTID_POS(file, pos)
66 FROM gtid_data
67 WHERE NOT gtid_eq(CONVERT(gtid_pos USING utf8),BINLOG_GTID_POS(file, pos))
68 ORDER BY idx;
69 idx gtid_pos BINLOG_GTID_POS(file, pos)
70 connection slave;
71 SET @orig_pos= @@GLOBAL.gtid_slave_pos;
72 SET @orig_t1_limit= (SELECT MAX(a) FROM t1);
73 *** Now connect the slave to each position in turn, and test that
74 *** the right amount of data is replicated at each point.
75 *** Test slave connecting to some GTID positions where the position in
76 *** the master's binlog is different between the different domains.
77 *** Revind the slave and test on the same binlog data from the master as before.
78 connection slave;
79 SET sql_log_bin= 0;
80 TRUNCATE gtid_data;
81 DELETE FROM t1 WHERE a > @orig_t1_limit;
82 SET sql_log_bin= 1;
83 SET GLOBAL gtid_slave_pos= @orig_pos;
84 connection master;
85 connection slave;
86 connection master;
87 DROP TABLE gtid_data, rand_data;
88 include/save_master_gtid.inc
89 connection slave;
90 include/start_slave.inc
91 include/sync_with_master_gtid.inc
92 connection master;
93 *** A lot of GTIDs with small btree pages to stress the Btree code.
94 SET GLOBAL binlog_gtid_index_page_size= 64;
95 SET GLOBAL binlog_gtid_index_span_min= 1;
96 *** Testing 1000 GTIDs with 50 test connects
97 connection master;
98 DELETE FROM t1 WHERE a >= 1000;
99 FLUSH NO_WRITE_TO_BINLOG BINARY LOGS;
100 CREATE TABLE rand_data(idx INT PRIMARY KEY, domain_id INT, server_id INT)
101 ENGINE=InnoDB;
102 INSERT INTO rand_data(idx, domain_id, server_id) VALUES (0, 0, 1);
103 INSERT INTO rand_data(idx, domain_id, server_id)
104 SELECT seq,
105 @tmp:=floor(10*POW(rand(150),2)),
106 100 + 5*@tmp + floor(5*rand(150))
107 FROM seq_1_to_1000;
108 SELECT COUNT(*), SUM(domain_id), SUM(server_id) FROM rand_data;
109 COUNT(*) SUM(domain_id) SUM(server_id)
110 1001 2881 116394
111 CREATE TABLE gtid_data(
112 idx INT PRIMARY KEY,
113 gtid VARCHAR(44),
114 gtid_pos VARCHAR(255),
115 file VARCHAR(100),
116 pos INT,
117 row_count INT,
118 KEY(file, pos)) ENGINE=InnoDB;
119 include/save_master_gtid.inc
120 connection slave;
121 include/sync_with_master_gtid.inc
122 include/stop_slave.inc
123 connection master;
124 SET @orig_domain_id= @@gtid_domain_id;
125 SET @orig_server_id= @@server_id;
126 SET gtid_domain_id= @orig_domain_id;
127 SET server_id= @orig_server_id;
128 SELECT COUNT(*) FROM gtid_data;
129 COUNT(*)
130 1000
131 *** The result should be empty, otherwise some result is wrong:
132 SELECT idx, gtid_pos, BINLOG_GTID_POS(file, pos)
133 FROM gtid_data
134 WHERE NOT gtid_eq(CONVERT(gtid_pos USING utf8),BINLOG_GTID_POS(file, pos))
135 ORDER BY idx;
136 idx gtid_pos BINLOG_GTID_POS(file, pos)
137 connection slave;
138 SET @orig_pos= @@GLOBAL.gtid_slave_pos;
139 SET @orig_t1_limit= (SELECT MAX(a) FROM t1);
140 *** Now connect the slave to each position in turn, and test that
141 *** the right amount of data is replicated at each point.
142 *** Test slave connecting to some GTID positions where the position in
143 *** the master's binlog is different between the different domains.
144 *** Revind the slave and test on the same binlog data from the master as before.
145 connection slave;
146 SET sql_log_bin= 0;
147 TRUNCATE gtid_data;
148 DELETE FROM t1 WHERE a > @orig_t1_limit;
149 SET sql_log_bin= 1;
150 SET GLOBAL gtid_slave_pos= @orig_pos;
151 connection master;
152 connection slave;
153 connection master;
154 DROP TABLE gtid_data, rand_data;
155 include/save_master_gtid.inc
156 connection slave;
157 include/start_slave.inc
158 include/sync_with_master_gtid.inc
159 connection master;
160 *** Small page size with sparse index.
161 SET GLOBAL binlog_gtid_index_page_size= 64;
162 SET GLOBAL binlog_gtid_index_span_min= 2048;
163 *** Testing 200 GTIDs with 50 test connects
164 connection master;
165 DELETE FROM t1 WHERE a >= 1000;
166 FLUSH NO_WRITE_TO_BINLOG BINARY LOGS;
167 CREATE TABLE rand_data(idx INT PRIMARY KEY, domain_id INT, server_id INT)
168 ENGINE=InnoDB;
169 INSERT INTO rand_data(idx, domain_id, server_id) VALUES (0, 0, 1);
170 INSERT INTO rand_data(idx, domain_id, server_id)
171 SELECT seq,
172 @tmp:=floor(10*POW(rand(666),2)),
173 100 + 5*@tmp + floor(5*rand(666))
174 FROM seq_1_to_200;
175 SELECT COUNT(*), SUM(domain_id), SUM(server_id) FROM rand_data;
176 COUNT(*) SUM(domain_id) SUM(server_id)
177 201 599 23410
178 CREATE TABLE gtid_data(
179 idx INT PRIMARY KEY,
180 gtid VARCHAR(44),
181 gtid_pos VARCHAR(255),
182 file VARCHAR(100),
183 pos INT,
184 row_count INT,
185 KEY(file, pos)) ENGINE=InnoDB;
186 include/save_master_gtid.inc
187 connection slave;
188 include/sync_with_master_gtid.inc
189 include/stop_slave.inc
190 connection master;
191 SET @orig_domain_id= @@gtid_domain_id;
192 SET @orig_server_id= @@server_id;
193 SET gtid_domain_id= @orig_domain_id;
194 SET server_id= @orig_server_id;
195 SELECT COUNT(*) FROM gtid_data;
196 COUNT(*)
197 200
198 *** The result should be empty, otherwise some result is wrong:
199 SELECT idx, gtid_pos, BINLOG_GTID_POS(file, pos)
200 FROM gtid_data
201 WHERE NOT gtid_eq(CONVERT(gtid_pos USING utf8),BINLOG_GTID_POS(file, pos))
202 ORDER BY idx;
203 idx gtid_pos BINLOG_GTID_POS(file, pos)
204 connection slave;
205 SET @orig_pos= @@GLOBAL.gtid_slave_pos;
206 SET @orig_t1_limit= (SELECT MAX(a) FROM t1);
207 *** Now connect the slave to each position in turn, and test that
208 *** the right amount of data is replicated at each point.
209 *** Test slave connecting to some GTID positions where the position in
210 *** the master's binlog is different between the different domains.
211 *** Revind the slave and test on the same binlog data from the master as before.
212 connection slave;
213 SET sql_log_bin= 0;
214 TRUNCATE gtid_data;
215 DELETE FROM t1 WHERE a > @orig_t1_limit;
216 SET sql_log_bin= 1;
217 SET GLOBAL gtid_slave_pos= @orig_pos;
218 connection master;
219 connection slave;
220 connection master;
221 DROP TABLE gtid_data, rand_data;
222 include/save_master_gtid.inc
223 connection slave;
224 include/start_slave.inc
225 include/sync_with_master_gtid.inc
226 connection master;
227 *** Medium page size.
228 SET GLOBAL binlog_gtid_index_page_size= 512;
229 SET GLOBAL binlog_gtid_index_span_min= 512;
230 *** Testing 200 GTIDs with 50 test connects
231 connection master;
232 DELETE FROM t1 WHERE a >= 1000;
233 FLUSH NO_WRITE_TO_BINLOG BINARY LOGS;
234 CREATE TABLE rand_data(idx INT PRIMARY KEY, domain_id INT, server_id INT)
235 ENGINE=InnoDB;
236 INSERT INTO rand_data(idx, domain_id, server_id) VALUES (0, 0, 1);
237 INSERT INTO rand_data(idx, domain_id, server_id)
238 SELECT seq,
239 @tmp:=floor(10*POW(rand(1024),2)),
240 100 + 5*@tmp + floor(5*rand(1024))
241 FROM seq_1_to_200;
242 SELECT COUNT(*), SUM(domain_id), SUM(server_id) FROM rand_data;
243 COUNT(*) SUM(domain_id) SUM(server_id)
244 201 555 23160
245 CREATE TABLE gtid_data(
246 idx INT PRIMARY KEY,
247 gtid VARCHAR(44),
248 gtid_pos VARCHAR(255),
249 file VARCHAR(100),
250 pos INT,
251 row_count INT,
252 KEY(file, pos)) ENGINE=InnoDB;
253 include/save_master_gtid.inc
254 connection slave;
255 include/sync_with_master_gtid.inc
256 include/stop_slave.inc
257 connection master;
258 SET @orig_domain_id= @@gtid_domain_id;
259 SET @orig_server_id= @@server_id;
260 SET gtid_domain_id= @orig_domain_id;
261 SET server_id= @orig_server_id;
262 SELECT COUNT(*) FROM gtid_data;
263 COUNT(*)
264 200
265 *** The result should be empty, otherwise some result is wrong:
266 SELECT idx, gtid_pos, BINLOG_GTID_POS(file, pos)
267 FROM gtid_data
268 WHERE NOT gtid_eq(CONVERT(gtid_pos USING utf8),BINLOG_GTID_POS(file, pos))
269 ORDER BY idx;
270 idx gtid_pos BINLOG_GTID_POS(file, pos)
271 connection slave;
272 SET @orig_pos= @@GLOBAL.gtid_slave_pos;
273 SET @orig_t1_limit= (SELECT MAX(a) FROM t1);
274 *** Now connect the slave to each position in turn, and test that
275 *** the right amount of data is replicated at each point.
276 *** Test slave connecting to some GTID positions where the position in
277 *** the master's binlog is different between the different domains.
278 *** Revind the slave and test on the same binlog data from the master as before.
279 connection slave;
280 SET sql_log_bin= 0;
281 TRUNCATE gtid_data;
282 DELETE FROM t1 WHERE a > @orig_t1_limit;
283 SET sql_log_bin= 1;
284 SET GLOBAL gtid_slave_pos= @orig_pos;
285 connection master;
286 connection slave;
287 connection master;
288 DROP TABLE gtid_data, rand_data;
289 include/save_master_gtid.inc
290 connection slave;
291 include/start_slave.inc
292 include/sync_with_master_gtid.inc
293 connection master;
294 *** Large page size.
295 SET GLOBAL binlog_gtid_index_page_size= 16384;
296 SET GLOBAL binlog_gtid_index_span_min= 1;
297 *** Testing 200 GTIDs with 50 test connects
298 connection master;
299 DELETE FROM t1 WHERE a >= 1000;
300 FLUSH NO_WRITE_TO_BINLOG BINARY LOGS;
301 CREATE TABLE rand_data(idx INT PRIMARY KEY, domain_id INT, server_id INT)
302 ENGINE=InnoDB;
303 INSERT INTO rand_data(idx, domain_id, server_id) VALUES (0, 0, 1);
304 INSERT INTO rand_data(idx, domain_id, server_id)
305 SELECT seq,
306 @tmp:=floor(10*POW(rand(12345),2)),
307 100 + 5*@tmp + floor(5*rand(12345))
308 FROM seq_1_to_200;
309 SELECT COUNT(*), SUM(domain_id), SUM(server_id) FROM rand_data;
310 COUNT(*) SUM(domain_id) SUM(server_id)
311 201 571 23252
312 CREATE TABLE gtid_data(
313 idx INT PRIMARY KEY,
314 gtid VARCHAR(44),
315 gtid_pos VARCHAR(255),
316 file VARCHAR(100),
317 pos INT,
318 row_count INT,
319 KEY(file, pos)) ENGINE=InnoDB;
320 include/save_master_gtid.inc
321 connection slave;
322 include/sync_with_master_gtid.inc
323 include/stop_slave.inc
324 connection master;
325 SET @orig_domain_id= @@gtid_domain_id;
326 SET @orig_server_id= @@server_id;
327 SET gtid_domain_id= @orig_domain_id;
328 SET server_id= @orig_server_id;
329 SELECT COUNT(*) FROM gtid_data;
330 COUNT(*)
331 200
332 *** The result should be empty, otherwise some result is wrong:
333 SELECT idx, gtid_pos, BINLOG_GTID_POS(file, pos)
334 FROM gtid_data
335 WHERE NOT gtid_eq(CONVERT(gtid_pos USING utf8),BINLOG_GTID_POS(file, pos))
336 ORDER BY idx;
337 idx gtid_pos BINLOG_GTID_POS(file, pos)
338 connection slave;
339 SET @orig_pos= @@GLOBAL.gtid_slave_pos;
340 SET @orig_t1_limit= (SELECT MAX(a) FROM t1);
341 *** Now connect the slave to each position in turn, and test that
342 *** the right amount of data is replicated at each point.
343 *** Test slave connecting to some GTID positions where the position in
344 *** the master's binlog is different between the different domains.
345 *** Revind the slave and test on the same binlog data from the master as before.
346 connection slave;
347 SET sql_log_bin= 0;
348 TRUNCATE gtid_data;
349 DELETE FROM t1 WHERE a > @orig_t1_limit;
350 SET sql_log_bin= 1;
351 SET GLOBAL gtid_slave_pos= @orig_pos;
352 connection master;
353 connection slave;
354 connection master;
355 DROP TABLE gtid_data, rand_data;
356 include/save_master_gtid.inc
357 connection slave;
358 include/start_slave.inc
359 include/sync_with_master_gtid.inc
360 connection master;
361 connection master;
362 SET GLOBAL binlog_gtid_index_page_size= @old_page_size;
363 SET GLOBAL binlog_gtid_index_span_min= @old_span_min;
364 DROP TABLE t1;
365 DROP FUNCTION gtid_eq;
366 include/rpl_end.inc