Debian Codegraph @

mysql-test/suite/rpl/t/rpl_server_id2.test

raw
1 # This test checks that a slave DOES execute queries originating
2 # from itself, if running with --replicate-same-server-id.
3
4 source include/master-slave.inc;
5
6 connection slave;
7 --source include/stop_slave.inc
8 CHANGE MASTER TO MASTER_USE_GTID=NO;
9 --source include/start_slave.inc
10
11 create table t1 (n int);
12 reset master;
13 # replicate ourselves
14 stop slave;
15 --source include/wait_for_slave_to_stop.inc
16 --replace_result $SLAVE_MYPORT SLAVE_PORT
17 eval change master to master_port=$SLAVE_MYPORT;
18 start slave;
19 --source include/wait_for_slave_to_start.inc
20 insert into t1 values (1);
21 save_master_pos;
22 sync_with_master;
23 select * from t1; # check that indeed 2 were inserted
24 # We stop the slave before cleaning up otherwise we'll get
25 # 'drop table t1' executed twice, so an error in the slave.err
26 # (not critical).
27 stop slave;
28 --source include/wait_for_slave_to_stop.inc
29 drop table t1;
30
31
32 #
33 # Bug#38934 slave slave until does not work with --replicate-same-server-id
34 #
35 # Verifying that slave performs all events until the master_log_pos
36 # in presense of --replicate-same-server-id the slave is started with.
37
38 connection master;
39 reset master;
40
41 # setting the until position to correspond to the last position of
42 # create table which will make the event executed and the slave sql
43 # thread stopped right after that.
44
45 create table t1(n int);
46 let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
47 dec $until_pos;
48 create table t2(n int);
49
50 connection slave;
51 --replace_result $MASTER_MYPORT MASTER_PORT
52 eval change master to master_port=$MASTER_MYPORT;
53 --replace_result $until_pos UNTIL_POS
54 eval start slave until master_log_file='master-bin.000001', master_log_pos=$until_pos;
55 --source include/wait_for_slave_io_to_start.inc
56 --source include/wait_for_slave_sql_to_stop.inc
57
58 --echo *** checking until position execution: must be only t1 in the list ***
59 show tables;
60
61 # cleanup
62
63 connection slave;
64 start slave sql_thread;
65
66 connection master;
67 drop table t1;
68 drop table t2;
69 sync_slave_with_master;
70
71 # End of tests
72 --source include/rpl_end.inc