mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / rpl / t / rpl_server_id2.test
blobaeb7292ed17f711246095b7674339555d5885674
1 # This test checks that a slave DOES execute queries originating
2 # from itself, if running with --replicate-same-server-id.
4 source include/master-slave.inc;
5 connection slave;
6 create table t1 (n int);
7 reset master;
8 # replicate ourselves
9 stop slave;
10 --replace_result $SLAVE_MYPORT SLAVE_PORT
11 eval change master to master_port=$SLAVE_MYPORT;
12 start slave;
13 insert into t1 values (1);
14 save_master_pos;
15 sync_with_master;
16 select * from t1; # check that indeed 2 were inserted
17 # We stop the slave before cleaning up otherwise we'll get
18 # 'drop table t1' executed twice, so an error in the slave.err
19 # (not critical).
20 stop slave;
21 drop table t1;
25 # Bug#38934 slave slave until does not work with --replicate-same-server-id
27 # Verifying that slave performs all events until the master_log_pos
28 # in presense of --replicate-same-server-id the slave is started with.
30 connection master;
31 reset master;
33 # setting the until position to correspond to the first following create table
34 # which will make the event executed and the slave sql thread stopped
35 # right after that.
36 let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
37 inc $until_pos;
39 create table t1(n int);
40 create table t2(n int);
42 connection slave;
43 --replace_result $MASTER_MYPORT MASTER_PORT
44 eval change master to master_port=$MASTER_MYPORT;
45 --replace_result $until_pos UNTIL_POS
46 eval start slave until master_log_file='master-bin.000001', master_log_pos=$until_pos;
47 --source include/wait_for_slave_io_to_start.inc
48 --source include/wait_for_slave_sql_to_stop.inc
50 --echo *** checking until position execution: must be only t1 in the list ***
51 show tables;
53 # cleanup
55 connection slave;
56 start slave sql_thread;
58 connection master;
59 drop table t1;
60 drop table t2;
61 sync_slave_with_master;
63 # End of tests
64 --source include/rpl_end.inc