2006-02-16 04:42:16 +01:00
|
|
|
-- source include/not_ndb_default.inc
|
2005-12-22 06:39:02 +01:00
|
|
|
-- source include/have_binlog_format_row.inc
|
|
|
|
-- source include/master-slave.inc
|
|
|
|
|
|
|
|
# Test is dependent on binlog positions
|
2003-09-14 00:13:41 +04:00
|
|
|
|
2003-09-16 02:58:46 +04:00
|
|
|
# prepare version for substitutions
|
|
|
|
let $VERSION=`select version()`;
|
|
|
|
|
2003-09-26 17:42:05 +04:00
|
|
|
# stop slave before he will start replication also sync with master
|
|
|
|
# for avoiding undetermenistic behaviour
|
|
|
|
save_master_pos;
|
2003-09-14 00:13:41 +04:00
|
|
|
connection slave;
|
2003-09-26 17:42:05 +04:00
|
|
|
sync_with_master;
|
2003-09-14 00:13:41 +04:00
|
|
|
stop slave;
|
2007-10-26 16:11:20 +02:00
|
|
|
# Make sure the slave sql and io thread has stopped
|
|
|
|
--source include/wait_for_slave_to_stop.inc
|
2003-09-14 00:13:41 +04:00
|
|
|
|
|
|
|
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;
|
2005-12-22 06:39:02 +01:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=311;
|
2007-06-19 16:06:11 +05:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2003-09-14 00:13:41 +04:00
|
|
|
# here table should be still not deleted
|
|
|
|
select * from t1;
|
2007-06-11 22:15:39 +02:00
|
|
|
source include/show_slave_status.inc;
|
2003-09-14 00:13:41 +04:00
|
|
|
|
|
|
|
# this should fail right after start
|
|
|
|
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
|
2007-06-19 16:06:11 +05:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2003-09-14 00:13:41 +04:00
|
|
|
# again this table should be still not deleted
|
|
|
|
select * from t1;
|
2007-06-11 22:15:39 +02:00
|
|
|
source include/show_slave_status.inc;
|
2003-09-14 00:13:41 +04:00
|
|
|
|
2005-12-22 06:39:02 +01:00
|
|
|
# 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;
|
2007-06-19 16:06:11 +05:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2003-09-14 00:13:41 +04:00
|
|
|
select * from t2;
|
2007-06-11 22:15:39 +02:00
|
|
|
source include/show_slave_status.inc;
|
2003-09-14 00:13:41 +04:00
|
|
|
|
|
|
|
# clean up
|
|
|
|
start slave;
|
|
|
|
connection master;
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
stop slave;
|
2007-10-26 16:11:20 +02:00
|
|
|
# Make sure the slave sql and io thread has stopped
|
|
|
|
--source include/wait_for_slave_to_stop.inc
|
2003-09-14 00:13:41 +04:00
|
|
|
|
2003-12-19 22:40:23 +01:00
|
|
|
# this should stop immediately as we are already there
|
2005-12-22 06:39:02 +01:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=740;
|
2007-06-19 16:06:11 +05:00
|
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
2003-09-14 00:13:41 +04:00
|
|
|
# here the sql slave thread should be stopped
|
2007-06-11 22:15:39 +02:00
|
|
|
--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
|
|
|
|
source include/show_slave_status.inc;
|
2003-09-14 00:13:41 +04:00
|
|
|
|
|
|
|
#testing various error conditions
|
2004-02-16 10:03:25 +02:00
|
|
|
--error 1277
|
2003-09-14 00:13:41 +04:00
|
|
|
start slave until master_log_file='master-bin', master_log_pos=561;
|
2004-02-16 10:03:25 +02:00
|
|
|
--error 1277
|
2003-09-14 00:13:41 +04:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
2004-02-16 10:03:25 +02:00
|
|
|
--error 1277
|
2003-09-14 00:13:41 +04:00
|
|
|
start slave until master_log_file='master-bin.000001';
|
2004-02-16 10:03:25 +02:00
|
|
|
--error 1277
|
2003-09-14 00:13:41 +04:00
|
|
|
start slave until relay_log_file='slave-relay-bin.000002';
|
2004-02-16 10:03:25 +02:00
|
|
|
--error 1277
|
2003-09-14 00:13:41 +04:00
|
|
|
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
|
2005-03-16 04:32:47 +03:00
|
|
|
# Warning should be given for second command
|
2003-09-14 00:13:41 +04:00
|
|
|
start slave sql_thread;
|
2005-12-22 06:39:02 +01:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=740;
|