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
|
--source include/have_sequence.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
--connection slave
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid= slave_pos;
--source include/start_slave.inc
--connection master
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0, 0);
--echo *** Test looking up a lot of different event positions and GTIDs.
# A function for comparing GTID positions.
# Handles that the domain_id order is different in the two strings.
# Works by repeatedly removing one GTID from each string. If the strings have
# the same length and nothing is left at the end, then they are identical.
delimiter //;
CREATE FUNCTION gtid_eq(a VARCHAR(255), b VARCHAR(255)) RETURNS BOOLEAN DETERMINISTIC
BEGIN
DECLARE g VARCHAR(255);
IF a IS NULL OR b IS NULL OR LENGTH(a) != LENGTH(b) THEN
RETURN FALSE;
END IF;
SET a= CONCAT(a, ',');
SET b= CONCAT(',', b, ',');
WHILE LENGTH(a) > 0 DO
SET g= REGEXP_SUBSTR(a, '^[^,]+,');
SET a= SUBSTRING(a, LENGTH(g)+1);
SET b= REPLACE(b, CONCAT(',', g), ',');
END WHILE;
RETURN b = ',';
END //
delimiter ;//
SET @old_page_size= @@GLOBAL.binlog_gtid_index_page_size;
SET @old_span_min= @@GLOBAL.binlog_gtid_index_span_min;
--echo *** A fair amount of work with default GTID index settings.
--let $NUM_POS= 200
--let $NUM_DOMAIN= 5
--let $NUM_SERVER= 5
--let $NUM_SLAVE_CONNECTS= 50
--let $RND_SEED= 42
--source suite/rpl/include/rpl_gtid_index.inc
--echo *** A lot of GTIDs with small btree pages to stress the Btree code.
--let $NUM_POS= 1000
--let $NUM_DOMAIN= 10
--let $RND_SEED= 150
SET GLOBAL binlog_gtid_index_page_size= 64;
SET GLOBAL binlog_gtid_index_span_min= 1;
--source suite/rpl/include/rpl_gtid_index.inc
--echo *** Small page size with sparse index.
--let $NUM_POS= 200
--let $RND_SEED= 666
SET GLOBAL binlog_gtid_index_page_size= 64;
SET GLOBAL binlog_gtid_index_span_min= 2048;
--source suite/rpl/include/rpl_gtid_index.inc
--echo *** Medium page size.
--let $NUM_POS= 200
--let $RND_SEED= 1024
SET GLOBAL binlog_gtid_index_page_size= 512;
SET GLOBAL binlog_gtid_index_span_min= 512;
--source suite/rpl/include/rpl_gtid_index.inc
--echo *** Large page size.
--let $NUM_POS= 200
--let $RND_SEED= 12345
SET GLOBAL binlog_gtid_index_page_size= 16384;
SET GLOBAL binlog_gtid_index_span_min= 1;
--source suite/rpl/include/rpl_gtid_index.inc
# Cleanup.
--connection master
SET GLOBAL binlog_gtid_index_page_size= @old_page_size;
SET GLOBAL binlog_gtid_index_span_min= @old_span_min;
DROP TABLE t1;
DROP FUNCTION gtid_eq;
--source include/rpl_end.inc
|