2006-08-30 09:22:43 +02:00
|
|
|
-- source include/have_binlog_format_mixed_or_statement.inc
|
2005-12-22 06:39:02 +01:00
|
|
|
-- source include/master-slave.inc
|
|
|
|
|
|
|
|
# Test is dependent on binlog positions
|
2003-09-13 22:13:41 +02:00
|
|
|
|
2003-09-16 00:58:46 +02:00
|
|
|
# prepare version for substitutions
|
|
|
|
let $VERSION=`select version()`;
|
|
|
|
|
2003-09-26 15:42:05 +02:00
|
|
|
# stop slave before he will start replication also sync with master
|
|
|
|
# for avoiding undetermenistic behaviour
|
|
|
|
save_master_pos;
|
2003-09-13 22:13:41 +02:00
|
|
|
connection slave;
|
2003-09-26 15:42:05 +02:00
|
|
|
sync_with_master;
|
2003-09-13 22:13:41 +02:00
|
|
|
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;
|
2005-12-22 06:39:02 +01:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=323;
|
2003-09-13 22:13:41 +02:00
|
|
|
sleep 2;
|
2005-07-04 22:27:16 +02:00
|
|
|
wait_for_slave_to_stop;
|
2003-09-13 22:13:41 +02:00
|
|
|
# here table should be still not deleted
|
|
|
|
select * from t1;
|
|
|
|
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
2005-12-12 17:51:56 +01:00
|
|
|
--replace_column 1 # 9 # 11 # 23 # 33 #
|
2006-05-11 16:29:02 +02:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
2003-09-13 22:13:41 +02:00
|
|
|
|
|
|
|
# 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;
|
2005-07-04 22:27:16 +02:00
|
|
|
wait_for_slave_to_stop;
|
2003-09-13 22:13:41 +02:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
2005-12-12 17:51:56 +01:00
|
|
|
--replace_column 1 # 9 # 11 # 23 # 33 #
|
2006-05-11 16:29:02 +02:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
2003-09-13 22:13:41 +02:00
|
|
|
|
2005-12-22 06:39:02 +01:00
|
|
|
# try replicate all up to and not including the second insert to t2;
|
2005-03-25 14:51:17 +01:00
|
|
|
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
|
2005-07-04 22:27:16 +02:00
|
|
|
sleep 2;
|
|
|
|
wait_for_slave_to_stop;
|
2003-09-13 22:13:41 +02:00
|
|
|
select * from t2;
|
|
|
|
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
2005-12-05 17:57:48 +01:00
|
|
|
--replace_column 1 # 9 # 11 # 23 # 33 #
|
2006-05-11 16:29:02 +02:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
2003-09-13 22:13:41 +02:00
|
|
|
|
|
|
|
# clean up
|
|
|
|
start slave;
|
|
|
|
connection master;
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
stop slave;
|
|
|
|
|
2003-12-19 22:40:23 +01:00
|
|
|
# this should stop immediately as we are already there
|
2005-03-25 14:51:17 +01:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=776;
|
2005-07-04 22:27:16 +02:00
|
|
|
sleep 2;
|
|
|
|
wait_for_slave_to_stop;
|
2003-09-13 22:13:41 +02:00
|
|
|
# here the sql slave thread should be stopped
|
2003-12-26 11:32:02 +01:00
|
|
|
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
|
2003-12-01 12:13:16 +01:00
|
|
|
--replace_column 1 # 9 # 23 # 33 #
|
2006-05-11 16:29:02 +02:00
|
|
|
--query_vertical SHOW SLAVE STATUS
|
2003-09-13 22:13:41 +02:00
|
|
|
|
|
|
|
#testing various error conditions
|
2004-02-16 09:03:25 +01:00
|
|
|
--error 1277
|
2003-09-13 22:13:41 +02:00
|
|
|
start slave until master_log_file='master-bin', master_log_pos=561;
|
2004-02-16 09:03:25 +01:00
|
|
|
--error 1277
|
2003-09-13 22:13:41 +02:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
2004-02-16 09:03:25 +01:00
|
|
|
--error 1277
|
2003-09-13 22:13:41 +02:00
|
|
|
start slave until master_log_file='master-bin.000001';
|
2004-02-16 09:03:25 +01:00
|
|
|
--error 1277
|
2003-09-13 22:13:41 +02:00
|
|
|
start slave until relay_log_file='slave-relay-bin.000002';
|
2004-02-16 09:03:25 +01:00
|
|
|
--error 1277
|
2003-09-13 22:13:41 +02:00
|
|
|
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
|
2005-03-16 02:32:47 +01:00
|
|
|
# Warning should be given for second command
|
2003-09-13 22:13:41 +02:00
|
|
|
start slave sql_thread;
|
2005-03-25 14:51:17 +01:00
|
|
|
start slave until master_log_file='master-bin.000001', master_log_pos=776;
|
2005-07-28 02:22:47 +02:00
|
|
|
|
|
|
|
# End of 4.1 tests
|