Debian Codegraph @

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

raw
1 # This test checks that in a dual-head setup
2 # A->B->A, where A has --log-slave-updates (why would it?
3 # assume that there is a C as slave of A),
4 # then the Exec_master_log_pos of SHOW SLAVE STATUS does
5 # not stay too low on B(BUG#13023 due to events ignored because
6 # of their server id).
7 # It also will test BUG#13861.
8
9 source include/have_innodb.inc;
10
11 --let $rpl_topology= 1->2->1
12 --source include/rpl_init.inc
13
14 # now we test it
15
16 connection server_2;
17
18 create table t1 (n int);
19 let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
20 let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
21 let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`;
22
23 --sync_slave_with_master server_1
24
25 #
26 # BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
27 # log-slave-updates and circul repl
28 #
29 source include/stop_slave.inc;
30
31 create table t2 (n int); # create one ignored event
32
33 --sync_slave_with_master server_2
34
35 show tables;
36
37 create table t3 (n int) engine=innodb;
38 let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
39 let $master_log_pos_2= `SELECT $master_log_pos_2 + 5`;
40 set @a=1;
41 insert into t3 values(@a);
42 let $master_log_pos_3= query_get_value(SHOW MASTER STATUS, Position, 1);
43 let $master_log_pos_3= `SELECT $master_log_pos_3 + 5`;
44 begin;
45 insert into t3 values(2);
46 insert into t3 values(3);
47 commit;
48 insert into t3 values(4);
49
50
51 connection server_1;
52
53 # bug is that START SLAVE UNTIL may stop too late, we test that by
54 # asking it to stop before creation of t3.
55
56 --replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
57 eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_1;
58 --source include/wait_for_slave_sql_to_stop.inc
59
60 # then BUG#13861 causes t3 to show up below (because stopped too
61 # late).
62
63 show tables;
64
65 # ensure that we do not break set @a=1; insert into t3 values(@a);
66 --replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
67 eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_2;
68 --source include/wait_for_slave_sql_to_stop.inc
69 select * from t3;
70
71 # ensure that we do not break transaction
72 --replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS
73 eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_3;
74 --source include/wait_for_slave_sql_to_stop.inc
75 select * from t3;
76
77 source include/start_slave.inc;
78
79 # BUG#13023 is that Exec_master_log_pos may stay too low "forever":
80
81 connection server_1;
82
83 create table t4 (n int); # create 3 ignored events
84 create table t5 (n int);
85 create table t6 (n int);
86
87 --sync_slave_with_master server_2
88
89 # then BUG#13023 caused hang below ("master" looks behind, while it's
90 # not in terms of updates done).
91 --sync_slave_with_master server_1
92
93 show tables;
94
95 # cleanup
96 drop table t1, t2, t3, t4, t5, t6;
97 --source include/rpl_end.inc