| 1 |
# This test checks that the slave rejects events originating |
| 2 |
# by a server from the list of ignored originators (bug#27808 etc) |
| 3 |
# |
| 4 |
# phases of tests: |
| 5 |
# |
| 6 |
# 0. master_id new line in show slave status |
| 7 |
# 1. syntax related: |
| 8 |
# a. error reporting if options clash; |
| 9 |
# b. overriding the old IGNORE_SERVER_IDS setup by the following |
| 10 |
# CHANGE MASTER ... IGNORE_SERVER_IDS= (list); |
| 11 |
# c. the old setup preserving by CHANGE MASTER w/o IGNORE_SERVER_IDS |
| 12 |
# d. resetting the ignored server ids with the empty list arg to |
| 13 |
# IGNORE_SERVER_IDS=() |
| 14 |
# e. RESET SLAVE preserves the list |
| 15 |
# f. RESET SLAVE ALL should empty the list. |
| 16 |
# 2. run time related: |
| 17 |
# a. observing no processing events from a master listed in IGNORE_SERVER_IDS |
| 18 |
# b. nullifying the list and resuming of taking binlog from the very beginning with |
| 19 |
# executing events this time |
| 20 |
# |
| 21 |
# Related BUGS: Bug #18816897- IGNORE_SERVER_IDS NOT RESETTING POST RESET SLAVE ALL |
| 22 |
# |
| 23 |
|
| 24 |
source include/master-slave.inc; |
| 25 |
source include/have_binlog_format_mixed.inc; |
| 26 |
|
| 27 |
connection slave; |
| 28 |
|
| 29 |
# a new line for master_id |
| 30 |
let $master_id= query_get_value(SHOW SLAVE STATUS, Master_Server_Id, 1); |
| 31 |
echo master_id: $master_id; |
| 32 |
|
| 33 |
stop slave; |
| 34 |
--echo *** --replicate-same-server-id and change master option can clash *** |
| 35 |
--replace_column 2 #### |
| 36 |
--error ER_REPLICA_IGNORE_SERVER_IDS |
| 37 |
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (2, 1); |
| 38 |
--echo *** must be empty due to the error *** |
| 39 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 40 |
echo ignore server id list: $ignore_list; |
| 41 |
|
| 42 |
--replace_column 2 #### |
| 43 |
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (10, 100); |
| 44 |
--echo *** must be 10, 100 *** |
| 45 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 46 |
echo ignore server id list: $ignore_list; |
| 47 |
reset slave; |
| 48 |
--echo *** must be still (10,100) after reset slave *** |
| 49 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 50 |
echo ignore server id list: $ignore_list; |
| 51 |
--replace_column 2 #### |
| 52 |
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (10, 100); |
| 53 |
--echo *** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup *** |
| 54 |
--replace_column 2 #### |
| 55 |
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1); |
| 56 |
--echo *** must be 1, 3, 4, 5 due to overriding policy *** |
| 57 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 58 |
echo ignore server id list: $ignore_list; |
| 59 |
--echo *** ignore master (server 1) queries for a while *** |
| 60 |
--source include/start_slave.inc |
| 61 |
|
| 62 |
connection master; |
| 63 |
|
| 64 |
#connection slave; |
| 65 |
--source include/sync_slave_sql_with_master.inc |
| 66 |
let $slave_relay_pos0= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); |
| 67 |
|
| 68 |
connection master; |
| 69 |
create table t1 (n int); |
| 70 |
let $master_binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 71 |
|
| 72 |
connection slave; |
| 73 |
let $slave_param= Exec_Master_Log_Pos; |
| 74 |
let $slave_param_value= $master_binlog_end; |
| 75 |
source include/wait_for_slave_param.inc; |
| 76 |
--echo *** must be empty as the event is to be filtered out *** |
| 77 |
show tables; |
| 78 |
--echo *** allowing events from master *** |
| 79 |
let $slave_relay_pos1= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); |
| 80 |
# |
| 81 |
# checking stability of relay log pos |
| 82 |
# |
| 83 |
if (`select $slave_relay_pos1 - $slave_relay_pos0`) |
| 84 |
{ |
| 85 |
--echo Error: relay log position changed: $slave_relay_pos0, $slave_relay_pos1 |
| 86 |
query_vertical show slave status; |
| 87 |
} |
| 88 |
|
| 89 |
stop slave; |
| 90 |
source include/wait_for_slave_to_stop.inc; |
| 91 |
reset slave; |
| 92 |
--replace_column 2 #### |
| 93 |
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (10, 100); |
| 94 |
--echo *** the list must remain (10, 100) after reset slave *** |
| 95 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 96 |
|
| 97 |
--replace_column 2 #### |
| 98 |
CHANGE REPLICATION SOURCE to IGNORE_SERVER_IDS= (); |
| 99 |
--echo *** must be empty due to IGNORE_SERVER_IDS empty list *** |
| 100 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 101 |
echo ignore server id list: $ignore_list; |
| 102 |
|
| 103 |
--echo *** RESET SLAVE ALL should empty the list *** |
| 104 |
|
| 105 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (10, 100); |
| 106 |
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); |
| 107 |
echo ignore server id list: $ignore_list; |
| 108 |
|
| 109 |
RESET SLAVE ALL; |
| 110 |
|
| 111 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 112 |
--replace_column 2 #### |
| 113 |
eval CHANGE REPLICATION SOURCE to SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT, SOURCE_USER='root'; |
| 114 |
--source include/start_slave.inc |
| 115 |
|
| 116 |
--let $assert_text= RESET SLAVE ALL must empty the list of server-ids. |
| 117 |
--let $assert_cond= "[SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1]" = "" |
| 118 |
--source include/assert.inc |
| 119 |
|
| 120 |
connection master; |
| 121 |
|
| 122 |
#connection slave; |
| 123 |
--source include/sync_slave_sql_with_master.inc |
| 124 |
--echo *** must have caught create table *** |
| 125 |
show tables; |
| 126 |
|
| 127 |
# cleanup |
| 128 |
connection master; |
| 129 |
drop table t1; |
| 130 |
#connection slave |
| 131 |
--source include/sync_slave_sql_with_master.inc |
| 132 |
|
| 133 |
--echo # === Bug#18192817 IGNORE_SERVER_IDS IS SHOWING DUPLICATE SERVER IDS === |
| 134 |
|
| 135 |
# The bug caused the field Replicate_Ignore_Server_Ids in SHOW SLAVE STATUS |
| 136 |
# show up duplicate values. Verify that the values are NOT duplicated. |
| 137 |
|
| 138 |
--source include/stop_slave.inc |
| 139 |
|
| 140 |
--echo The list should have 0 elements. |
| 141 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 142 |
--source include/show_slave_status.inc |
| 143 |
--echo |
| 144 |
|
| 145 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420); |
| 146 |
|
| 147 |
--echo The list should have 4 elements. |
| 148 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 149 |
--source include/show_slave_status.inc |
| 150 |
--echo |
| 151 |
|
| 152 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (110,220,330,420); |
| 153 |
|
| 154 |
--echo The list should still have only 4 elements. |
| 155 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 156 |
--source include/show_slave_status.inc |
| 157 |
--echo |
| 158 |
|
| 159 |
--echo ISSUE WAS HERE: All server ids should be stored and showed only once, while they are set twice or even more. |
| 160 |
--echo The list should have 5 elements. |
| 161 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,220,330,420); |
| 162 |
|
| 163 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 164 |
--source include/show_slave_status.inc |
| 165 |
--echo |
| 166 |
|
| 167 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,221,330,420); |
| 168 |
|
| 169 |
--echo The list should have 6 elements. |
| 170 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 171 |
--source include/show_slave_status.inc |
| 172 |
--echo |
| 173 |
|
| 174 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,221,331,420); |
| 175 |
|
| 176 |
--echo The list should have 7 elements. |
| 177 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 178 |
--source include/show_slave_status.inc |
| 179 |
--echo |
| 180 |
|
| 181 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (110,220,330,420), IGNORE_SERVER_IDS= (111,221,331,421); |
| 182 |
|
| 183 |
--echo The list should have 8 elements. |
| 184 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 185 |
--source include/show_slave_status.inc |
| 186 |
--echo |
| 187 |
|
| 188 |
# Cleanup |
| 189 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (); |
| 190 |
|
| 191 |
--echo The list should have NO elements. |
| 192 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 193 |
--source include/show_slave_status.inc |
| 194 |
--echo |
| 195 |
|
| 196 |
--echo # === Bug #18593479: ON MASTER_INFO_REPOSITORY CHANGE, === |
| 197 |
--echo # === IGNORE_SERVER_IDS DOUBLES WITH DUP VALUES === |
| 198 |
|
| 199 |
# The bug caused the ignore_server_list to double the set of values everytime |
| 200 |
# the repository type changed. This was seen when changing from FILE repository |
| 201 |
# to TABLE repository or vice-versa. For example given repository type= FILE |
| 202 |
# ignore_server_ids= (5, 10, 15) followed by |
| 203 |
# SET GLOBAL master_info_repository='TABLE'; |
| 204 |
# would make ignore_server_ids= (5, 10, 15, 5, 10, 15). |
| 205 |
# |
| 206 |
# Also a SET GLOBAL master_info_repository= FILE again would make |
| 207 |
# ignore_server_ids= (5, 10, 15, 5, 10, 15, 5, 10, 15, 5, 10, 15). |
| 208 |
|
| 209 |
--let $saved_repo_type= `SELECT @@GLOBAL.MASTER_INFO_REPOSITORY` |
| 210 |
|
| 211 |
SET GLOBAL master_info_repository= 'FILE'; |
| 212 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (5,10,15); |
| 213 |
--source include/start_slave.inc |
| 214 |
|
| 215 |
--echo Expect 3 elements. |
| 216 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 217 |
--source include/show_slave_status.inc |
| 218 |
--echo |
| 219 |
|
| 220 |
--source include/stop_slave.inc |
| 221 |
SET GLOBAL master_info_repository= 'TABLE'; |
| 222 |
--source include/start_slave.inc |
| 223 |
|
| 224 |
|
| 225 |
--echo |
| 226 |
--echo ISSUE WAS HERE: Due to buggy behaviour, we woule see 6 elements here. |
| 227 |
-- echo Expect 3 elements ONLY to verify the fix when changing from FILE->TABLE. |
| 228 |
|
| 229 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 230 |
--source include/show_slave_status.inc |
| 231 |
--echo |
| 232 |
|
| 233 |
--source include/stop_slave.inc |
| 234 |
SET GLOBAL master_info_repository= 'FILE'; |
| 235 |
--source include/start_slave.inc |
| 236 |
|
| 237 |
--echo |
| 238 |
--echo ISSUE WAS HERE TOO: Due to buggy behaviour, we woule see 12 elements here. |
| 239 |
-- echo Expect 3 elements ONLY to verify the fix when changinf from TABLE->FILE. |
| 240 |
|
| 241 |
--let $status_items= Replicate_Ignore_Server_Ids |
| 242 |
--source include/show_slave_status.inc |
| 243 |
--echo |
| 244 |
|
| 245 |
# Cleanup |
| 246 |
--source include/stop_slave.inc |
| 247 |
CHANGE REPLICATION SOURCE TO IGNORE_SERVER_IDS= (); |
| 248 |
--disable_warnings |
| 249 |
--disable_query_log ONCE |
| 250 |
--eval SET GLOBAL master_info_repository= '$saved_repo_type' |
| 251 |
--enable_warnings |
| 252 |
--source include/start_slave.inc |
| 253 |
--connection master |
| 254 |
|
| 255 |
--source include/rpl_end.inc |