Debian Codegraph @

mysql-test/suite/rpl_nogtid/t/rpl_mts_debug.test

raw
1 ################################################################################
2 # This test case checks if MTS allows to concurrently access the replication
3 # tables, and as such, concurrently commit transactions that update different
4 # databases.
5 #
6 # It does so by making the workers' threads to sleep after updating replication
7 # tables but before releasing locks and committing the current transaction.
8 ################################################################################
9
10 --source include/not_group_replication_plugin.inc
11 --source include/have_debug.inc
12 # no format specific tests so we run it only in MIXED mode
13 --source include/have_binlog_format_mixed.inc
14 --source include/master-slave.inc
15
16 --connection master
17 CREATE DATABASE db_1;
18 CREATE DATABASE db_2;
19
20 CREATE TABLE db_1.test_1 (id INTEGER) engine=Innodb;
21 CREATE TABLE db_2.test_1 (id INTEGER) engine=Innodb;
22
23 --connection master
24 --source include/sync_slave_sql_with_master.inc
25
26 --connection slave
27 --source include/stop_slave.inc
28 set @save.replica_parallel_workers= @@global.replica_parallel_workers;
29 set @save.debug= @@global.debug;
30 SET @@global.replica_parallel_workers= 2;
31 ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
32 ALTER TABLE mysql.slave_worker_info ENGINE= Innodb;
33 --source include/start_slave.inc
34
35 --connection master
36
37 # Create two slave side parallelizable transactions.
38 # Logical_Clock requires one more which is the first
39 # one in binlog as a warmup.
40 INSERT INTO db_1.test_1 VALUES(0);
41 --source include/sync_slave_sql_with_master.inc
42 SET GLOBAL debug="+d,mta_debug_concurrent_access";
43
44 --connection master
45 BEGIN;
46 INSERT INTO db_1.test_1 VALUES(1);
47 --connection master1
48 BEGIN;
49 INSERT INTO db_2.test_1 VALUES(1);
50 --connection master
51 COMMIT;
52 --connection master1
53 COMMIT;
54
55 DROP DATABASE db_1;
56 DROP DATABASE db_2;
57 --source include/sync_slave_sql_with_master.inc
58
59 --source include/stop_slave.inc
60 --disable_warnings
61 SET @@global.replica_parallel_workers= @save.replica_parallel_workers;
62 --enable_warnings
63 SET @@global.debug= @save.debug;
64 --source include/start_slave.inc
65
66 #
67 # Bug#12964649 MTS memory not released
68 #
69 # Originally reported when opt_replica_checkpoint_group is set to be greater
70 # than sizeof(BLOB) * 8 - 1 Workers initialization code fails.
71 # VALID_RANGE() for opt_replica_checkpoint_group is fixed in bug12979420.
72 #
73 # The current bug test simulates a failure to start by a Worker
74 # thread, checks the error, and verifies that all memory is released
75 # (valgrind proves, the user can watch top report).
76 #
77
78 connection slave;
79
80 call mtr.add_suppression('Error reading replica worker configuration');
81 call mtr.add_suppression('Failed during replica workers initialization');
82 call mtr.add_suppression('Failed during replica worker thread creation for channel ''');
83
84 source include/stop_slave.inc;
85 set @save.replica_checkpoint_group= @@global.replica_checkpoint_group;
86 set @save.replica_parallel_workers= @@global.replica_parallel_workers;
87
88 # The following assignment can work only with debug builds.
89 # It sets opt_replica_checkpoint_group to one more to its VALID_RANGE() maximum.
90 # set @@global.replica_checkpoint_group= 524280 + 1;
91
92 set @save.debug= @@global.debug;
93 SET @@global.debug= "+d,mta_worker_thread_fails";
94 set @@global.replica_parallel_workers= 2;
95
96 start slave sql_thread;
97 --let $slave_sql_errno= 13117
98 source include/wait_for_slave_sql_error.inc;
99
100 set @@global.replica_checkpoint_group= @save.replica_checkpoint_group;
101 --disable_warnings
102 set @@global.replica_parallel_workers= @save.replica_parallel_workers;
103 --enable_warnings
104 set @@global.debug= @save.debug;
105
106 # Bug#24679056:MULTI-THREADED SLAVE LEAKS WORKER THREADS IN CASE
107 # OF THREAD CREATE FAILURE
108 #
109 # The current test verifies that there is no orphaned SQL worker thread
110 # by setting the assert_count= 0, when we check the output of
111 # SELECT *FROM PROCESSLIST table, this is same as SHOW PROCESSLIST.
112
113 --let $assert_text= Verified that their is no orphaned SQL worker thread
114 --let $assert_cond= `SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='Waiting for an event from Coordinator'`
115 --source include/assert.inc
116 --source include/start_slave.inc
117 #
118 # BUG#13681205 : REPLICATION FAILS DURING SLAVE WORKERS INITIALIZATION,
119 # CRASHES SLAVE
120 #
121 # This test checks that the slave starts correctly, even
122 # if we set the maximum of replica_checkpoint_group higher
123 # than the maximum (the server adjusts it to the proper
124 # value).
125 #
126 --connection master
127 --source include/rpl_reset.inc
128
129 --connection slave
130 --source include/stop_slave.inc
131 call mtr.add_suppression("option 'replica_checkpoint_group': unsigned value 524281 adjusted to 524280");
132 call mtr.add_suppression("Failed during replica worker thread create");
133 call mtr.add_suppression("Replica SQL for channel '': Failed during replica workers initialization, Error_code: MY-13117");
134 call mtr.add_suppression("Mismatch between the number of bytes configured to store checkpoint information and the previously stored information");
135
136 set @save.replica_checkpoint_group= @@global.replica_checkpoint_group;
137 set @save.replica_parallel_workers= @@global.replica_parallel_workers;
138
139 SET @@global.replica_parallel_workers= 2;
140 SET @@global.replica_checkpoint_group=524281;
141
142 ## TEST #1
143
144 # check that slave will start with the replica_checkpoint_group
145 # if include/start_slave.inc does not timeout then the slave was able to start correctly
146 --source include/start_slave.inc
147
148 --let $assert_cond= @@replica_checkpoint_group=524280
149 --let $assert_text= Assert that replica_checkpoint_group was truncated to a valid value.
150 --source include/assert.inc
151
152 --source include/check_slave_is_running.inc
153
154 --source include/rpl_reset.inc
155
156 ## TEST #2
157 #
158 # Check that even if the initialization of the info storage
159 # fails the server won't crash.
160
161 --source include/stop_slave.inc
162 --let $saved_debug=`SELECT @global.debug`
163 SET @@global.debug= "+d,inject_init_worker_init_info_fault";
164 START SLAVE SQL_THREAD;
165 --let $slave_sql_errno=13117
166 --source include/wait_for_slave_sql_error.inc
167 SET @@global.debug= @save.debug;
168
169 # cleanup
170
171 set @@global.replica_checkpoint_group= @save.replica_checkpoint_group;
172 --disable_warnings
173 set @@global.replica_parallel_workers= @save.replica_parallel_workers;
174 --enable_warnings
175
176 #
177 # BUG13893310 Checkpoint_group
178 #
179 # testing various error branches with simulating errors:
180 #
181
182 ## Rpl_info_factory::reset_workers() error branch
183
184 call mtr.add_suppression("Could not delete from Replica Workers info repository.");
185 # restart slave with workers
186 --source include/stop_slave.inc
187 set @save.replica_parallel_workers= @@global.replica_parallel_workers;
188 set @@global.replica_parallel_workers= 2;
189 --source include/start_slave.inc
190 --source include/stop_slave.inc
191
192 set @@global.debug= "+d,mta_debug_reset_workers_fails";
193
194 let $relay_file = query_get_value( SHOW SLAVE STATUS, Relay_Log_File, 1 );
195 let $relay_pos = query_get_value( SHOW SLAVE STATUS, Relay_Log_Pos, 1 );
196 --replace_regex /relay_log_file=[^,]+/RELAY_LOG_FILE=FILE/ /relay_log_pos=[0-9]+/ RELAY_LOG_POS= POS/
197 --error ER_MTA_RESET_WORKERS
198 eval CHANGE REPLICATION SOURCE to relay_log_file='$relay_file', relay_log_pos=$relay_pos;
199
200 ## Relay_log_info::reset_workers_recovered() error branch
201
202 set @@global.debug= "-d,mta_debug_reset_workers_fails";
203 set @@global.debug= "+d,mta_debug_recovery_reset_fails";
204 start slave sql_thread;
205 # ER_REPLICA_FATAL_ERROR
206 --let $slave_sql_errno=13117
207 --source include/wait_for_slave_sql_error.inc
208
209 #
210 # mts_recovery_groups() error branche
211 #
212
213 set @@global.debug= @save.debug;
214
215 set @@global.replica_parallel_workers= 2;
216 --source include/start_slave.inc
217 --source include/stop_slave.inc
218
219 call mtr.add_suppression("Error creating applier metadata: Failed to initialize the worker info structure.");
220
221 set @@global.debug= "+d,mta_replica_worker_init_at_gaps_fails";
222 --error ER_CONNECTION_METADATA
223 start slave sql_thread;
224
225 #
226 # clean up
227 #
228 set @@global.debug= "-d,mta_replica_worker_init_at_gaps_fails";
229 --disable_warnings
230 set @@global.replica_parallel_workers= @save.replica_parallel_workers;
231 --enable_warnings
232 --source include/start_slave.inc
233 --source include/rpl_reset.inc
234 --source include/rpl_end.inc