rpl_until.test 2.61 KB
Newer Older
1 2
source include/master-slave.inc;

3 4 5
# prepare version for substitutions
let $VERSION=`select version()`;

6 7 8
# stop slave before he will start replication also sync with master
# for avoiding undetermenistic behaviour
save_master_pos;
9
connection slave;
10
sync_with_master;
11 12 13 14 15 16 17 18 19 20 21
stop slave;

connection master;
# create some events on master
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
22
--replace_result $VERSION VERSION
23 24 25 26
show binlog events;

# try to replicate all queries until drop of t1
connection slave;
27
start slave until master_log_file='master-bin.000001', master_log_pos=319;
28
sleep 2;
29
wait_for_slave_to_stop;
30 31 32
# here table should be still not deleted
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
33
--replace_column 1 # 9 # 23 # 33 #
34 35 36 37 38 39 40
show slave status;

# this should fail right after start
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
# again this table should be still not deleted
select * from t1;
sleep 2;
41
wait_for_slave_to_stop;
42
--replace_result $MASTER_MYPORT MASTER_MYPORT
43
--replace_column 1 # 9 # 23 # 33 #
44 45 46
show slave status;

# try replicate all until second insert to t2;
47
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
48 49
sleep 2;
wait_for_slave_to_stop;
50 51
select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT
52
--replace_column 1 # 9 # 11 # 23 # 33 #
53 54 55 56 57 58 59 60 61 62
show slave status;

# clean up
start slave;
connection master;
save_master_pos;
connection slave;
sync_with_master;
stop slave;

63
# this should stop immediately as we are already there
64
start slave until master_log_file='master-bin.000001', master_log_pos=776;
65 66
sleep 2;
wait_for_slave_to_stop;
67
# here the sql slave thread should be stopped
68
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
69
--replace_column 1 # 9 # 23 # 33 #
70 71 72
show slave status;

#testing various error conditions
unknown's avatar
unknown committed
73
--error 1277
74
start slave until master_log_file='master-bin', master_log_pos=561;
unknown's avatar
unknown committed
75
--error 1277
76
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
unknown's avatar
unknown committed
77
--error 1277
78
start slave until master_log_file='master-bin.000001';
unknown's avatar
unknown committed
79
--error 1277
80
start slave until relay_log_file='slave-relay-bin.000002';
unknown's avatar
unknown committed
81
--error 1277
82
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
unknown's avatar
unknown committed
83
# Warning should be given for second command
84
start slave sql_thread;
85
start slave until master_log_file='master-bin.000001', master_log_pos=776;
86 87

# End of 4.1 tests