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