2001-07-18 22:26:43 +02:00
|
|
|
# test case to make slave thread get ahead by 22 bytes
|
|
|
|
|
|
|
|
source include/master-slave.inc;
|
2002-08-08 02:12:02 +02:00
|
|
|
|
2001-07-18 22:26:43 +02:00
|
|
|
# first, cause a duplicate key problem on the slave
|
|
|
|
create table t1(n int auto_increment primary key);
|
2002-10-25 01:46:14 +02:00
|
|
|
sync_slave_with_master;
|
2001-07-18 22:26:43 +02:00
|
|
|
insert into t1 values (2);
|
|
|
|
connection master;
|
|
|
|
insert into t1 values(NULL);
|
|
|
|
insert into t1 values(NULL);
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
2002-09-11 05:40:08 +02:00
|
|
|
sleep 3; # there is no way around this sleep - we have to wait until
|
2001-07-18 22:26:43 +02:00
|
|
|
# the slave tries to run the query, fails and aborts slave thread
|
|
|
|
delete from t1 where n = 2;
|
2002-10-25 01:46:14 +02:00
|
|
|
start slave;
|
2001-07-18 22:26:43 +02:00
|
|
|
sync_with_master;
|
|
|
|
#now the buggy slave would be confused on the offset but it can replicate
|
|
|
|
#in order to make it break, we need to stop/start the slave one more time
|
2002-10-25 01:46:14 +02:00
|
|
|
stop slave;
|
2001-07-18 22:26:43 +02:00
|
|
|
connection master;
|
|
|
|
# to be able to really confuse the slave, we need some non-auto-increment
|
|
|
|
# events in the log
|
|
|
|
create table t2(n int);
|
|
|
|
drop table t2;
|
|
|
|
insert into t1 values(NULL);
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
2002-10-25 01:46:14 +02:00
|
|
|
start slave;
|
2001-07-18 22:26:43 +02:00
|
|
|
#now the truth comes out - if the slave is buggy, it will never sync because
|
|
|
|
#the slave thread is not able to read events
|
|
|
|
sync_with_master;
|
|
|
|
select * from t1;
|
|
|
|
#clean up
|
|
|
|
connection master;
|
|
|
|
drop table t1;
|
2002-10-25 01:46:14 +02:00
|
|
|
sync_slave_with_master;
|
2001-07-18 22:26:43 +02:00
|
|
|
|