Current Path : /home/usr.opt/mysql57/mysql-test/suite/rpl/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/rpl/t/rpl_server_id_ignore.test |
# 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_SLAVE_IGNORE_SERVER_IDS change master 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 master 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 master 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 master 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 master 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 master 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 MASTER 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 master to master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_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 MASTER 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 MASTER 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 MASTER 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 MASTER 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 MASTER 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 MASTER 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 MASTER 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 MASTER 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 MASTER TO IGNORE_SERVER_IDS= (); --disable_query_log ONCE --eval SET GLOBAL master_info_repository= '$saved_repo_type' --source include/start_slave.inc --connection master --source include/rpl_end.inc