| 1 | . ./init.shscip-shell source . . `./init.sh`. |
| 2 | |
| 3 | mysql $M test -e "insert into t1 values(2, 200, 'aaaaaa')" |
| 4 | sleepscip-shell system . . sleep. 1 |
| 5 | mysql $S2 -e "stop slave" |
| 6 | is_gtid_supported |
| 7 | if testscip-shell system . . test. $? = 1 |
| 8 | then |
| 9 | mysql $S2 -e "change master to master_host='127.0.0.1', master_port=$S1P, master_user='rsandbox', master_password='rsandbox'" |
| 10 | else |
| 11 | mysql $S1 -e "reset master" |
| 12 | mysql $S2 -e "change master to master_host='127.0.0.1', master_port=$S1P, master_user='rsandbox', master_password='rsandbox', master_log_file='mysql-bin.000001', master_log_pos=4" |
| 13 | fi |
| 14 | mysql $S2 -e "start slave" |
| 15 | |
| 16 | check_master $0 $S2P $S1P |
| 17 | |
| 18 | masterha_master_switch --master_state=alive --interactive=0 --conf=$CONF --new_master_host=127.0.0.1 --new_master_port=$S1P > switch.log 2>&1 |
| 19 | fail_if_zero $0 $? |
| 20 | |
| 21 | masterha_master_switch --master_state=alive --interactive=0 --conf=mha_test_multi.cnf --new_master_host=127.0.0.1 --new_master_port=$S1P > switch.log 2>&1 |
| 22 | fail_if_zero $0 $? |
| 23 | |
| 24 | mysql $S1 -e "set global read_only=1" |
| 25 | |
| 26 | masterha_master_switch --master_state=alive --interactive=0 --conf=$CONF --new_master_host=127.0.0.1 --new_master_port=$S1P > switch.log 2>&1 |
| 27 | fail_if_zero $0 $? |
| 28 | |
| 29 | masterha_master_switch --master_state=alive --interactive=0 --conf=mha_test_multi.cnf --new_master_host=127.0.0.1 --new_master_port=$S1P > switch.log 2>&1 |
| 30 | fail_if_nonzero $0 $? |
| 31 | |
| 32 | check_master $0 $S2P $S1P |
| 33 | mysql $S1 test -e "insert into t1 values(10000003, 300, 'bbbaaaaaaa');" |
| 34 | check_count $0 $MP 2 |
| 35 | ./check $0 3 |