1
by brian
clean slate |
1 |
-- source include/not_ndb_default.inc
|
2 |
-- source include/have_binlog_format_row.inc
|
|
3 |
-- source include/master-slave.inc
|
|
4 |
||
5 |
# Test is dependent on binlog positions |
|
6 |
||
7 |
# prepare version for substitutions |
|
8 |
let $VERSION=`select version()`; |
|
9 |
||
10 |
# stop slave before he will start replication also sync with master |
|
11 |
# for avoiding undetermenistic behaviour |
|
12 |
save_master_pos; |
|
13 |
connection slave; |
|
14 |
sync_with_master; |
|
15 |
stop slave; |
|
16 |
# Make sure the slave sql and io thread has stopped |
|
17 |
--source include/wait_for_slave_to_stop.inc
|
|
18 |
||
19 |
connection master; |
|
20 |
# create some events on master |
|
21 |
create table t1(n int not null auto_increment primary key); |
|
22 |
insert into t1 values (1),(2),(3),(4); |
|
23 |
drop table t1; |
|
24 |
create table t2(n int not null auto_increment primary key); |
|
25 |
insert into t2 values (1),(2); |
|
26 |
insert into t2 values (3),(4); |
|
27 |
drop table t2; |
|
28 |
||
29 |
# try to replicate all queries until drop of t1 |
|
30 |
connection slave; |
|
31 |
start slave until master_log_file='master-bin.000001', master_log_pos=311; |
|
32 |
--source include/wait_for_slave_sql_to_stop.inc
|
|
33 |
# here table should be still not deleted |
|
34 |
select * from t1; |
|
35 |
source include/show_slave_status.inc; |
|
36 |
||
37 |
# this should fail right after start |
|
38 |
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 |
# again this table should be still not deleted |
|
41 |
select * from t1; |
|
42 |
source include/show_slave_status.inc; |
|
43 |
||
44 |
# try replicate all up to and not including the second insert to t2; |
|
45 |
start slave until relay_log_file='slave-relay-bin.000003', relay_log_pos=728; |
|
46 |
--source include/wait_for_slave_sql_to_stop.inc
|
|
47 |
select * from t2; |
|
48 |
source include/show_slave_status.inc; |
|
49 |
||
50 |
# clean up |
|
51 |
start slave; |
|
52 |
connection master; |
|
53 |
save_master_pos; |
|
54 |
connection slave; |
|
55 |
sync_with_master; |
|
56 |
stop slave; |
|
57 |
# Make sure the slave sql and io thread has stopped |
|
58 |
--source include/wait_for_slave_to_stop.inc
|
|
59 |
||
60 |
# this should stop immediately as we are already there |
|
61 |
start slave until master_log_file='master-bin.000001', master_log_pos=740; |
|
62 |
--source include/wait_for_slave_sql_to_stop.inc
|
|
63 |
# here the sql slave thread should be stopped |
|
64 |
--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
|
|
65 |
source include/show_slave_status.inc; |
|
66 |
||
67 |
#testing various error conditions |
|
68 |
--error 1277
|
|
69 |
start slave until master_log_file='master-bin', master_log_pos=561; |
|
70 |
--error 1277
|
|
71 |
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; |
|
72 |
--error 1277
|
|
73 |
start slave until master_log_file='master-bin.000001'; |
|
74 |
--error 1277
|
|
75 |
start slave until relay_log_file='slave-relay-bin.000002'; |
|
76 |
--error 1277
|
|
77 |
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; |
|
78 |
# Warning should be given for second command |
|
79 |
start slave sql_thread; |
|
80 |
start slave until master_log_file='master-bin.000001', master_log_pos=740; |