Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_gtids_table_disable_log_replica_updates.test

raw
1 #
2 # ==== Purpose ====
3 #
4 # WL#6559 Optimize GTIDs for passive slave - store GTIDs in table
5 #
6 # Verify that we can store gtids into gtid_executed table for transactions
7 # on binlog rotation and report GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED
8 # correctly on slave when binlog is enabled and log_replica_updates is diabled.
9 #
10
11 --source include/force_myisam_default.inc
12 --source include/have_myisam.inc
13 --source include/not_group_replication_plugin.inc
14 --source include/only_mts_replica_parallel_workers.inc
15 --source include/have_debug.inc
16 --source include/have_debug_sync.inc
17 --let $rpl_gtid_utils= 1
18 --source include/master-slave.inc
19
20 --connection slave
21
22 --let $debug_point= dont_compress_gtid_table
23 --source include/add_debug_point.inc
24
25 --connection master
26
27 --let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
28
29 CREATE TABLE IF NOT EXISTS t1 (a INT) ENGINE=InnoDB;
30 CREATE TABLE t2 (a INT) ENGINE=MyISAM;
31 INSERT INTO t1 VALUES(1);
32 INSERT INTO t2 VALUES(1);
33 --echo #
34 --echo # Verify that transactions' gtids can be reported
35 --echo # from global.gtid_executed correctly.
36 --echo #
37 --let $assert_text= committed gtids MASTER_UUID:1-4
38 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-4"
39 --source include/assert.inc
40 --echo #
41 --echo # Store gtids MASTER_UUID:1-4 in gtid_executed table on binlog rotation
42 --echo #
43 FLUSH LOGS;
44 --replace_result $master_uuid MASTER_UUID
45 SELECT * FROM mysql.gtid_executed;
46
47 --source include/sync_slave_sql_with_master.inc
48 --echo #
49 --echo # connection slave
50 --echo #
51 --let $replica_uuid= `SELECT @@GLOBAL.SERVER_UUID`
52 --let $assert_text= committed gtids MASTER_UUID:1-4
53 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-4"
54 --source include/assert.inc
55 --echo #
56 --echo # Verify that slave thread stores gtid into gtid_executed table within
57 --echo # each transaction if binlog is on and log_slave_updated is disabled.
58 --echo #
59 --replace_result $master_uuid MASTER_UUID
60 SELECT * FROM mysql.gtid_executed;
61 SET @@GLOBAL.DEBUG= '-d, dont_compress_gtid_table';
62
63 INSERT INTO t1 VALUES(2);
64 INSERT INTO t2 VALUES(2);
65 --echo #
66 --echo # Verify that store gtids SLAVE_UUID:1-2 into gtid_executed table,
67 --echo # which is also compressed on binlog rotation.
68 --echo #
69
70 SET @old_compression_period= @@GLOBAL.GTID_EXECUTED_COMPRESSION_PERIOD;
71 SET @@GLOBAL.GTID_EXECUTED_COMPRESSION_PERIOD= 1;
72 FLUSH LOGS;
73 SET @@GLOBAL.GTID_EXECUTED_COMPRESSION_PERIOD= @old_compression_period;
74
75 --let $table= mysql.gtid_executed
76 --let $count= 2
77 --source include/wait_until_rows_count.inc
78
79 --replace_result $master_uuid MASTER_UUID
80 --eval SELECT * FROM mysql.gtid_executed where source_uuid="$master_uuid"
81 --replace_result $replica_uuid SLAVE_UUID
82 --eval SELECT * FROM mysql.gtid_executed where source_uuid="$replica_uuid"
83
84 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
85 --echo #
86 --echo # Verify that we can get the correct set of gtid_purged when purging
87 --echo # logs if binlog is enabled and log_replica_updates is disabled.
88 --echo #
89 --eval PURGE BINARY LOGS TO '$binlog_file'
90 --let $assert_text= purged gtids SLAVE_UUID:1-2,MASTER_UUID:1-4
91 --let $assert_cond= GTID_IS_EQUAL("[SELECT @@GLOBAL.GTID_PURGED]", "$replica_uuid:1-2,$master_uuid:1-4")
92 --source include/assert.inc
93
94 --echo #
95 --echo # Verify that we can get the correct set from 'gtid_executed' table
96 --echo # when executing a big transaction that exceeds the max size of the
97 --echo # binlog if binlog is enabled and log_replica_updates is disabled.
98 --echo #
99 SET @SIZE_DEFAULT=@@MAX_BINLOG_SIZE;
100 SET GLOBAL MAX_BINLOG_SIZE=4096;
101 SET @@GLOBAL.DEBUG= '+d, dont_compress_gtid_table';
102
103 --let $saved_binlog_transaction_compression = `SELECT @@session.binlog_transaction_compression`
104 SET @@session.binlog_transaction_compression=FALSE;
105
106 --let $i= 1
107 BEGIN;
108 while ($i < 60) {
109 --eval INSERT INTO t1 VALUES ($i);
110 --inc $i
111 }
112 COMMIT;
113
114 --let $debug_point= dont_compress_gtid_table
115 --source include/remove_debug_point.inc
116
117 SET GLOBAL MAX_BINLOG_SIZE=@SIZE_DEFAULT;
118
119 --replace_result $master_uuid MASTER_UUID
120 --eval SELECT * FROM mysql.gtid_executed where source_uuid="$master_uuid"
121 --replace_result $replica_uuid SLAVE_UUID
122 --eval SELECT * FROM mysql.gtid_executed where source_uuid="$replica_uuid"
123
124 --replace_result $saved_binlog_transaction_compression SAVED
125 --eval SET @@session.binlog_transaction_compression= $saved_binlog_transaction_compression
126
127 --connection master
128 DROP TABLE t1,t2;
129
130 --source include/rpl_end.inc