Debian Codegraph @

mysql-test/suite/rpl/t/rpl_gtid_index.test

raw
1 --source include/have_sequence.inc
2 --source include/have_innodb.inc
3 --source include/master-slave.inc
4 --source include/have_binlog_format_mixed.inc
5
6 --connection slave
7 --source include/stop_slave.inc
8 CHANGE MASTER TO master_use_gtid= slave_pos;
9 --source include/start_slave.inc
10
11 --connection master
12 CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
13 INSERT INTO t1 VALUES (0, 0);
14
15
16 --echo *** Test looking up a lot of different event positions and GTIDs.
17
18 # A function for comparing GTID positions.
19 # Handles that the domain_id order is different in the two strings.
20 # Works by repeatedly removing one GTID from each string. If the strings have
21 # the same length and nothing is left at the end, then they are identical.
22 delimiter //;
23 CREATE FUNCTION gtid_eq(a VARCHAR(255), b VARCHAR(255)) RETURNS BOOLEAN DETERMINISTIC
24 BEGIN
25 DECLARE g VARCHAR(255);
26 IF a IS NULL OR b IS NULL OR LENGTH(a) != LENGTH(b) THEN
27 RETURN FALSE;
28 END IF;
29 SET a= CONCAT(a, ',');
30 SET b= CONCAT(',', b, ',');
31 WHILE LENGTH(a) > 0 DO
32 SET g= REGEXP_SUBSTR(a, '^[^,]+,');
33 SET a= SUBSTRING(a, LENGTH(g)+1);
34 SET b= REPLACE(b, CONCAT(',', g), ',');
35 END WHILE;
36 RETURN b = ',';
37 END //
38 delimiter ;//
39
40 SET @old_page_size= @@GLOBAL.binlog_gtid_index_page_size;
41 SET @old_span_min= @@GLOBAL.binlog_gtid_index_span_min;
42
43 --echo *** A fair amount of work with default GTID index settings.
44 --let $NUM_POS= 200
45 --let $NUM_DOMAIN= 5
46 --let $NUM_SERVER= 5
47 --let $NUM_SLAVE_CONNECTS= 50
48 --let $RND_SEED= 42
49 --source suite/rpl/include/rpl_gtid_index.inc
50
51 --echo *** A lot of GTIDs with small btree pages to stress the Btree code.
52 --let $NUM_POS= 1000
53 --let $NUM_DOMAIN= 10
54 --let $RND_SEED= 150
55 SET GLOBAL binlog_gtid_index_page_size= 64;
56 SET GLOBAL binlog_gtid_index_span_min= 1;
57 --source suite/rpl/include/rpl_gtid_index.inc
58
59 --echo *** Small page size with sparse index.
60 --let $NUM_POS= 200
61 --let $RND_SEED= 666
62 SET GLOBAL binlog_gtid_index_page_size= 64;
63 SET GLOBAL binlog_gtid_index_span_min= 2048;
64 --source suite/rpl/include/rpl_gtid_index.inc
65
66 --echo *** Medium page size.
67 --let $NUM_POS= 200
68 --let $RND_SEED= 1024
69 SET GLOBAL binlog_gtid_index_page_size= 512;
70 SET GLOBAL binlog_gtid_index_span_min= 512;
71 --source suite/rpl/include/rpl_gtid_index.inc
72
73 --echo *** Large page size.
74 --let $NUM_POS= 200
75 --let $RND_SEED= 12345
76 SET GLOBAL binlog_gtid_index_page_size= 16384;
77 SET GLOBAL binlog_gtid_index_span_min= 1;
78 --source suite/rpl/include/rpl_gtid_index.inc
79
80
81 # Cleanup.
82 --connection master
83 SET GLOBAL binlog_gtid_index_page_size= @old_page_size;
84 SET GLOBAL binlog_gtid_index_span_min= @old_span_min;
85
86 DROP TABLE t1;
87 DROP FUNCTION gtid_eq;
88
89 --source include/rpl_end.inc