rpl_row_until.test 2.82 KB
Newer Older
1
-- source include/not_ndb_default.inc
2 3 4 5
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc

# Test is dependent on binlog positions
6

7 8 9
# prepare version for substitutions
let $VERSION=`select version()`;

10 11 12
# stop slave before he will start replication also sync with master
# for avoiding undetermenistic behaviour
save_master_pos;
13
connection slave;
14
sync_with_master;
15 16 17 18 19 20 21 22 23 24 25 26 27 28
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;

# try to replicate all queries until drop of t1
connection slave;
29
start slave until master_log_file='master-bin.000001', master_log_pos=311;
30
--source include/wait_for_slave_sql_to_stop.inc
31 32 33
# here table should be still not deleted
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
34
--replace_column 1 # 9 # 11 # 23 # 33 #
35
--query_vertical SHOW SLAVE STATUS;
36 37 38

# this should fail right after start
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
39
--source include/wait_for_slave_sql_to_stop.inc
40 41 42
# again this table should be still not deleted
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
43
--replace_column 1 # 9 # 11 # 23 # 33 #
44
--query_vertical SHOW SLAVE STATUS;
45

46 47
# try replicate all up to and not including the second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
48
--source include/wait_for_slave_sql_to_stop.inc
49 50
select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT
51
--replace_column 1 # 9 # 11 # 23 # 33 #
52
--query_vertical SHOW SLAVE STATUS;
53 54 55 56 57 58 59 60 61

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

62
# this should stop immediately as we are already there
63
start slave until master_log_file='master-bin.000001', master_log_pos=740;
64
--source include/wait_for_slave_sql_to_stop.inc
65
# here the sql slave thread should be stopped
66
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
67
--replace_column 1 # 9 # 23 # 33 #
68
--query_vertical SHOW SLAVE STATUS;
69 70

#testing various error conditions
monty@mysql.com's avatar
monty@mysql.com committed
71
--error 1277
72
start slave until master_log_file='master-bin', master_log_pos=561;
monty@mysql.com's avatar
monty@mysql.com committed
73
--error 1277
74
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
monty@mysql.com's avatar
monty@mysql.com committed
75
--error 1277
76
start slave until master_log_file='master-bin.000001';
monty@mysql.com's avatar
monty@mysql.com committed
77
--error 1277
78
start slave until relay_log_file='slave-relay-bin.000002';
monty@mysql.com's avatar
monty@mysql.com committed
79
--error 1277
80
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
81
# Warning should be given for second command
82
start slave sql_thread;
83
start slave until master_log_file='master-bin.000001', master_log_pos=740;