diff options
Diffstat (limited to 'mysql-test/t/rpl000016.test')
-rw-r--r-- | mysql-test/t/rpl000016.test | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test index f9ef99c62b6..fd30188ea89 100644 --- a/mysql-test/t/rpl000016.test +++ b/mysql-test/t/rpl000016.test @@ -26,10 +26,40 @@ select * from t1; connection master; flush logs; drop table if exists t2; -create table t2(m int); +create table t2(m int not null primary key); insert into t2 values (34),(67),(123); +save_master_pos; flush logs; show master logs; + +#now lets make some duplicate key mess and see if we can recover from it + +#first insert a value on the slave +connection slave; +sync_with_master; +insert into t2 values(1234); + +#same value on the master +connection master; +save_master_pos; +insert into t2 values(1234); +connection slave; +sync_with_master; + +#the slave may have already stopped, so we ignore the error +!slave stop; + +#restart slave skipping one event +set sql_slave_skip_counter=1; +slave start; + +connection master; +save_master_pos; + +#let slave catch up +connection slave; +sync_with_master; +connection master; purge master logs to 'master-bin.003'; show master logs; insert into t2 values (65); @@ -38,6 +68,25 @@ connection slave; sync_with_master; show slave status; select * from t2; -drop table if exists t1,t2; connection master; -drop table if exists t1,t2; +let $1=100; +drop table if exists t3; +create table t3 (n int); +while ($1) +{ + insert into t3 values(4); + dec $1; +} +show master logs; +save_master_pos; +connection slave; +slave stop; +slave start; +sync_with_master; +select count(*) from t3 where n = 4; +#clean up +connection master; +drop table if exists t1,t2,t3; +save_master_pos; +connection slave; +sync_with_master; |