mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / engines / funcs / t / rpl_stm_mystery22.test
blob017593fdfbac2fa9fceddb331c8d979689ff0cae
1 ################################
2 # Change Author: JBM
3 # Change Date: 2006-01-12
4 # Change: Added back have stm binlog
5 # and added requirments comments
6 ################################
7 # test case to make slave thread get ahead by 22 bytes
8 ################################
9 #REQUIREMENT: If there is a faked slave duplicate key insert 
10 #error and the slave is restarted, the replication should 
11 #proceed in a correct way.
12 ################################
13 #REQUIREMENT: If there is a faked slave non-existing record 
14 #delete error and the slave is restarted, then the replication 
15 #should proceed in a correct way.
16 #################################
18 -- source include/have_binlog_format_mixed_or_statement.inc
19 -- source include/master-slave.inc
21 # first, cause a duplicate key problem on the slave
22 create table t1(n int auto_increment primary key, s char(10));
23 sync_slave_with_master;
24 insert into t1 values (2,'old');
25 connection master;
26 insert into t1 values(NULL,'new');
27 insert into t1 values(NULL,'new');
28 save_master_pos;
29 connection slave;
30 # wait until the slave tries to run the query, fails and aborts slave thread
31 wait_for_slave_to_stop;
32 select * from t1 order by n;
33 delete from t1 where n = 2;
34 --disable_warnings
35 start slave;
36 --enable_warnings
37 sync_with_master;
38 #now the buggy slave would be confused on the offset but it can replicate
39 #in order to make it break, we need to stop/start the slave one more time
40 stop slave;
41 connection master;
42 # to be able to really confuse the slave, we need some non-auto-increment
43 # events in the log
44 create table t2(n int);
45 drop table t2;
46 insert into t1 values(NULL,'new');
47 # what happens when we delete a row which does not exist on slave?
48 set sql_log_bin=0;
49 insert into t1 values(NULL,'new');
50 set sql_log_bin=1;
51 delete from t1 where n=4;
52 save_master_pos;
53 connection slave;
54 --disable_warnings
55 start slave;
56 --enable_warnings
57 #now the truth comes out - if the slave is buggy, it will never sync because
58 #the slave thread is not able to read events
59 sync_with_master;
60 select * from t1 order by n;
61 #clean up
62 connection master;
63 drop table t1;
64 sync_slave_with_master;
66 # End of 4.1 tests