mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
ad126d90e0
This includes both code and test cases.
52 lines
1.5 KiB
Text
52 lines
1.5 KiB
Text
-- source include/have_binlog_format_statement.inc
|
|
|
|
# test case to make slave thread get ahead by 22 bytes
|
|
|
|
-- source include/master-slave.inc
|
|
|
|
# first, cause a duplicate key problem on the slave
|
|
create table t1(n int auto_increment primary key, s char(10));
|
|
sync_slave_with_master;
|
|
insert into t1 values (2,'old');
|
|
connection master;
|
|
insert into t1 values(NULL,'new');
|
|
insert into t1 values(NULL,'new');
|
|
save_master_pos;
|
|
connection slave;
|
|
# wait until the slave tries to run the query, fails and aborts slave thread
|
|
wait_for_slave_to_stop;
|
|
select * from t1 order by n;
|
|
delete from t1 where n = 2;
|
|
--disable_warnings
|
|
start slave;
|
|
--enable_warnings
|
|
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
|
|
stop slave;
|
|
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,'new');
|
|
# what happens when we delete a row which does not exist on slave?
|
|
set sql_log_bin=0;
|
|
insert into t1 values(NULL,'new');
|
|
set sql_log_bin=1;
|
|
delete from t1 where n=4;
|
|
save_master_pos;
|
|
connection slave;
|
|
--disable_warnings
|
|
start slave;
|
|
--enable_warnings
|
|
#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 order by n;
|
|
#clean up
|
|
connection master;
|
|
drop table t1;
|
|
sync_slave_with_master;
|
|
|
|
# End of 4.1 tests
|