File: rpl_mts_debug.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (234 lines) | stat: -rw-r--r-- 8,146 bytes parent folder | download
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
################################################################################
# This test case checks if MTS allows to concurrently access the replication
# tables, and as such, concurrently commit transactions that update different
# databases.
#
# It does so by making the workers' threads to sleep after updating replication
# tables but before releasing locks and committing the current transaction.
################################################################################

--source include/not_group_replication_plugin.inc
--source include/have_debug.inc
# no format specific tests so we run it only in MIXED mode
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc

--connection master
CREATE DATABASE db_1;
CREATE DATABASE db_2;

CREATE TABLE db_1.test_1 (id INTEGER) engine=Innodb;
CREATE TABLE db_2.test_1 (id INTEGER) engine=Innodb;

--connection master
--source include/sync_slave_sql_with_master.inc

--connection slave
--source include/stop_slave.inc
set @save.replica_parallel_workers= @@global.replica_parallel_workers;
set @save.debug= @@global.debug;
SET @@global.replica_parallel_workers= 2;
ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
ALTER TABLE mysql.slave_worker_info ENGINE= Innodb;
--source include/start_slave.inc

--connection master

# Create two slave side parallelizable transactions.
# Logical_Clock requires one more which is the first
# one in binlog as a warmup.
INSERT INTO db_1.test_1 VALUES(0);
--source include/sync_slave_sql_with_master.inc
SET GLOBAL debug="+d,mta_debug_concurrent_access";

--connection master
BEGIN;
INSERT INTO db_1.test_1 VALUES(1);
--connection master1
BEGIN;
INSERT INTO db_2.test_1 VALUES(1);
--connection master
COMMIT;
--connection master1
COMMIT;

DROP DATABASE db_1;
DROP DATABASE db_2;
--source include/sync_slave_sql_with_master.inc

--source include/stop_slave.inc
--disable_warnings
SET @@global.replica_parallel_workers= @save.replica_parallel_workers;
--enable_warnings
SET @@global.debug= @save.debug;
--source include/start_slave.inc

#
# Bug#12964649 MTS memory not released
#
# Originally reported when opt_replica_checkpoint_group is set to be greater
# than sizeof(BLOB) * 8 - 1 Workers initialization code fails.
# VALID_RANGE() for opt_replica_checkpoint_group is fixed in bug12979420.
# 
# The current bug test simulates a failure to start by a Worker
# thread, checks the error, and verifies that all memory is released
# (valgrind proves, the user can watch top report).
#

connection slave;

call mtr.add_suppression('Error reading replica worker configuration');
call mtr.add_suppression('Failed during replica workers initialization');
call mtr.add_suppression('Failed during replica worker thread creation for channel ''');

source include/stop_slave.inc;
set @save.replica_checkpoint_group= @@global.replica_checkpoint_group;
set @save.replica_parallel_workers= @@global.replica_parallel_workers;

# The following assignment can work only with debug builds.
# It sets opt_replica_checkpoint_group to one more to its VALID_RANGE() maximum.
# set @@global.replica_checkpoint_group= 524280 + 1;

set @save.debug= @@global.debug;
SET @@global.debug= "+d,mta_worker_thread_fails";
set @@global.replica_parallel_workers= 2;

start slave sql_thread;
--let $slave_sql_errno= 13117
source include/wait_for_slave_sql_error.inc;

set @@global.replica_checkpoint_group= @save.replica_checkpoint_group;
--disable_warnings
set @@global.replica_parallel_workers= @save.replica_parallel_workers;
--enable_warnings
set @@global.debug= @save.debug;

# Bug#24679056:MULTI-THREADED SLAVE LEAKS WORKER THREADS IN CASE
#              OF THREAD CREATE FAILURE
#
# The current test verifies that there is no orphaned SQL worker thread
# by setting the assert_count= 0, when we check the output of
# SELECT *FROM PROCESSLIST table, this is same as SHOW PROCESSLIST.

--let $assert_text= Verified that their is no orphaned SQL worker thread
--let $assert_cond= `SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='Waiting for an event from Coordinator'`
--source include/assert.inc
--source include/start_slave.inc
#
# BUG#13681205 : REPLICATION FAILS DURING SLAVE WORKERS INITIALIZATION, 
#                CRASHES SLAVE 
#
# This test checks that the slave starts correctly, even
# if we set the maximum of replica_checkpoint_group higher
# than the maximum (the server adjusts it to the proper
# value).                    
#
--connection master
--source include/rpl_reset.inc

--connection slave
--source include/stop_slave.inc
call mtr.add_suppression("option 'replica_checkpoint_group': unsigned value 524281 adjusted to 524280");
call mtr.add_suppression("Failed during replica worker thread create");
call mtr.add_suppression("Replica SQL for channel '': Failed during replica workers initialization, Error_code: MY-13117");
call mtr.add_suppression("Mismatch between the number of bytes configured to store checkpoint information and the previously stored information");

set @save.replica_checkpoint_group= @@global.replica_checkpoint_group;
set @save.replica_parallel_workers= @@global.replica_parallel_workers;

SET @@global.replica_parallel_workers= 2;
SET @@global.replica_checkpoint_group=524281;

## TEST #1 

# check that slave will start with the replica_checkpoint_group
# if include/start_slave.inc does not timeout then the slave was able to start correctly
--source include/start_slave.inc

--let $assert_cond= @@replica_checkpoint_group=524280
--let $assert_text= Assert that replica_checkpoint_group was truncated to a valid value.
--source include/assert.inc

--source include/check_slave_is_running.inc

--source include/rpl_reset.inc

## TEST #2
#
# Check that even if the initialization of the info storage
# fails the server won't crash.

--source include/stop_slave.inc
--let $saved_debug=`SELECT @global.debug`
SET @@global.debug= "+d,inject_init_worker_init_info_fault";
START SLAVE SQL_THREAD;
--let $slave_sql_errno=13117
--source include/wait_for_slave_sql_error.inc
SET @@global.debug= @save.debug;

# cleanup

set @@global.replica_checkpoint_group= @save.replica_checkpoint_group;
--disable_warnings
set @@global.replica_parallel_workers= @save.replica_parallel_workers;
--enable_warnings

#
# BUG13893310 Checkpoint_group
#
# testing various error branches with simulating errors:
#

## Rpl_info_factory::reset_workers() error branch

call mtr.add_suppression("Could not delete from Replica Workers info repository.");
# restart slave with workers
--source include/stop_slave.inc
set @save.replica_parallel_workers= @@global.replica_parallel_workers;
set @@global.replica_parallel_workers= 2;
--source include/start_slave.inc
--source include/stop_slave.inc

set @@global.debug= "+d,mta_debug_reset_workers_fails";

let $relay_file = query_get_value( SHOW SLAVE STATUS, Relay_Log_File, 1 );
let $relay_pos = query_get_value( SHOW SLAVE STATUS, Relay_Log_Pos, 1 );
--replace_regex /relay_log_file=[^,]+/RELAY_LOG_FILE=FILE/ /relay_log_pos=[0-9]+/ RELAY_LOG_POS= POS/
--error ER_MTA_RESET_WORKERS
eval CHANGE REPLICATION SOURCE to relay_log_file='$relay_file', relay_log_pos=$relay_pos;

## Relay_log_info::reset_workers_recovered() error branch

set @@global.debug= "-d,mta_debug_reset_workers_fails";
set @@global.debug= "+d,mta_debug_recovery_reset_fails";
start slave sql_thread;
# ER_REPLICA_FATAL_ERROR
--let $slave_sql_errno=13117
--source include/wait_for_slave_sql_error.inc

#
# mts_recovery_groups() error branche
#

set @@global.debug= @save.debug;

set @@global.replica_parallel_workers= 2;
--source include/start_slave.inc
--source include/stop_slave.inc

call mtr.add_suppression("Error creating applier metadata: Failed to initialize the worker info structure.");

set @@global.debug= "+d,mta_replica_worker_init_at_gaps_fails";
--error ER_CONNECTION_METADATA
start slave sql_thread;

#
# clean up
#
set @@global.debug= "-d,mta_replica_worker_init_at_gaps_fails";
--disable_warnings
set @@global.replica_parallel_workers= @save.replica_parallel_workers;
--enable_warnings
--source include/start_slave.inc
--source include/rpl_reset.inc
--source include/rpl_end.inc