File: rpl_server_id_ignore.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 (255 lines) | stat: -rw-r--r-- 9,047 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# This test checks that the slave rejects events originating
# by a server from the list of ignored originators (bug#27808 etc)
#
# phases of tests:
#
# 0. master_id new line in show slave status
# 1. syntax related:
#    a. error reporting if options clash;
#    b. overriding the old IGNORE_SERVER_IDS setup by the following
#       CHANGE MASTER ... IGNORE_SERVER_IDS= (list);
#    c. the old setup preserving by CHANGE MASTER w/o IGNORE_SERVER_IDS
#    d. resetting the ignored server ids with the empty list arg to
#       IGNORE_SERVER_IDS=()
#    e. RESET SLAVE preserves the list
#    f. RESET SLAVE ALL should empty the list.
# 2. run time related:
#    a. observing no processing events from a master listed in IGNORE_SERVER_IDS
#    b. nullifying the list and resuming of taking binlog from the very beginning with
#       executing events this time
#
# Related BUGS: Bug #18816897- IGNORE_SERVER_IDS NOT RESETTING POST RESET SLAVE ALL
#

source include/master-slave.inc;
source include/have_binlog_format_mixed.inc;

connection slave;

# a new line for master_id
let $master_id= query_get_value(SHOW SLAVE STATUS, Master_Server_Id, 1);
echo master_id: $master_id;

stop slave;
--echo *** --replicate-same-server-id and change master option can clash ***
--replace_column 2 ####
--error ER_REPLICA_IGNORE_SERVER_IDS
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (2, 1);
--echo *** must be empty due to the error ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;

--replace_column 2 ####
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (10, 100);
--echo *** must be 10, 100 ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;
reset slave;
--echo *** must be still (10,100) after reset slave ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;
--replace_column 2 ####
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (10, 100);
--echo *** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup ***
--replace_column 2 ####
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1);
--echo *** must be 1, 3, 4, 5 due to overriding policy ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;
--echo *** ignore master (server 1) queries for a while ***
--source include/start_slave.inc

connection master;

#connection slave;
--source include/sync_slave_sql_with_master.inc
let $slave_relay_pos0= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);

connection master;
create table t1 (n int);
let $master_binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1);

connection slave;
let $slave_param= Exec_Master_Log_Pos;
let $slave_param_value= $master_binlog_end;
source include/wait_for_slave_param.inc;
--echo *** must be empty as the event is to be filtered out ***
show tables;
--echo *** allowing events from master ***
let $slave_relay_pos1= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
#
# checking stability of relay log pos
#
if (`select $slave_relay_pos1 - $slave_relay_pos0`)
{
    --echo Error: relay log position changed:  $slave_relay_pos0, $slave_relay_pos1
    query_vertical show slave status;
}

stop slave;
source include/wait_for_slave_to_stop.inc;
reset slave;
--replace_column 2 ####
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (10, 100);
--echo *** the list must remain (10, 100) after reset slave ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);

--replace_column 2 ####
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= ();
--echo *** must be empty due to IGNORE_SERVER_IDS empty list ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;

--echo *** RESET SLAVE ALL should empty the list ***

CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (10, 100);
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;

RESET SLAVE ALL;

--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 2 ####
eval CHANGE REPLICATION SOURCE to SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT, SOURCE_USER='root';
--source include/start_slave.inc

--let $assert_text= RESET SLAVE ALL must empty the list of server-ids.
--let $assert_cond= "[SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1]" = ""
--source include/assert.inc

connection master;

#connection slave;
--source include/sync_slave_sql_with_master.inc
--echo *** must have caught create table ***
show tables;

# cleanup
connection master;
drop table t1;
#connection slave
--source include/sync_slave_sql_with_master.inc

--echo # === Bug#18192817 IGNORE_SERVER_IDS IS SHOWING DUPLICATE SERVER IDS ===

# The bug caused the field Replicate_Ignore_Server_Ids in SHOW SLAVE STATUS
# show up duplicate values. Verify that the values are NOT duplicated.

--source include/stop_slave.inc

--echo The list should have 0 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420);

--echo The list should have 4 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (110,220,330,420);

--echo The list should still have only 4 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

--echo ISSUE WAS HERE: All server ids should be stored and showed only once, while they are set twice or even more.
--echo The list should have 5 elements.
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,220,330,420);

--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,221,330,420);

--echo The list should have 6 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,221,331,420);

--echo The list should have 7 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,221,331,421);

--echo The list should have 8 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

# Cleanup
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= ();

--echo The list should have NO elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

--echo # === Bug #18593479: ON MASTER_INFO_REPOSITORY CHANGE, ===
--echo # === IGNORE_SERVER_IDS DOUBLES WITH DUP VALUES        ===

# The bug caused the ignore_server_list to double the set of values everytime
# the repository type changed. This was seen when changing from FILE repository
# to TABLE repository or vice-versa. For example given repository type= FILE
#  ignore_server_ids= (5, 10, 15) followed by
#  SET GLOBAL master_info_repository='TABLE';
#  would make ignore_server_ids= (5, 10, 15, 5, 10, 15).
#
#  Also a SET GLOBAL master_info_repository= FILE again would make
#  ignore_server_ids= (5, 10, 15, 5, 10, 15, 5, 10, 15, 5, 10, 15).

--let $saved_repo_type= `SELECT @@GLOBAL.MASTER_INFO_REPOSITORY`

SET GLOBAL master_info_repository= 'FILE';
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (5,10,15);
--source include/start_slave.inc

--echo Expect 3 elements.
--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

--source include/stop_slave.inc
SET GLOBAL master_info_repository= 'TABLE';
--source include/start_slave.inc


--echo
--echo ISSUE WAS HERE: Due to buggy behaviour, we woule see 6 elements here.
-- echo Expect 3 elements ONLY to verify the fix when changing from FILE->TABLE.

--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

--source include/stop_slave.inc
SET GLOBAL master_info_repository= 'FILE';
--source include/start_slave.inc

--echo
--echo ISSUE WAS HERE TOO: Due to buggy behaviour, we woule see 12 elements here.
-- echo Expect 3 elements ONLY to verify the fix when changinf from TABLE->FILE.

--let $status_items= Replicate_Ignore_Server_Ids
--source include/show_slave_status.inc
--echo

# Cleanup
--source include/stop_slave.inc
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= ();
--disable_warnings
--disable_query_log ONCE
--eval SET GLOBAL master_info_repository= '$saved_repo_type'
--enable_warnings
--source include/start_slave.inc
--connection master

--source include/rpl_end.inc