Debian Codegraph @

mysql-test/suite/rpl/t/rpl_optimize.test

raw
1 # Test for BUG#1858 "OPTIMIZE TABLE done by a client
2 # thread stops the slave SQL thread".
3 # You can replace OPTIMIZE by REPAIR.
4 #####################################
5 # Change Author: JBM
6 # Change Date: 2006-02-09
7 # OPTIMIZE for memory tables. If and when
8 # it does support for Disk Data, a new
9 # version of this test will be need.
10 #####################################
11 # Slow test, don't run during staging part
12 -- source include/not_staging.inc
13 -- source include/master-slave.inc
14
15 --disable_warnings
16 drop tables if exists t1;
17 --enable_warnings
18
19 disable_query_log;
20 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
21 enable_query_log;
22
23 create table t1 (a int not null auto_increment primary key, b int, key(b));
24 INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
25 --disable_warnings
26 INSERT INTO t1 (a) SELECT null FROM t1;
27 INSERT INTO t1 (a) SELECT null FROM t1;
28 INSERT INTO t1 (a) SELECT null FROM t1;
29 INSERT INTO t1 (a) SELECT null FROM t1;
30 INSERT INTO t1 (a) SELECT null FROM t1;
31 INSERT INTO t1 (a) SELECT null FROM t1;
32 INSERT INTO t1 (a) SELECT null FROM t1;
33 INSERT INTO t1 (a) SELECT null FROM t1;
34 INSERT INTO t1 (a) SELECT null FROM t1;
35 INSERT INTO t1 (a) SELECT null FROM t1;
36 INSERT INTO t1 (a) SELECT null FROM t1;
37 INSERT INTO t1 (a) SELECT null FROM t1;
38 INSERT INTO t1 (a) SELECT null FROM t1;
39 --enable_warnings
40 save_master_pos;
41 # a few updates to force OPTIMIZE to do something
42 --disable_warnings
43 update t1 set b=(a/2*rand());
44 delete from t1 order by b limit 10000;
45 --enable_warnings
46
47 connection slave;
48 sync_with_master;
49 optimize table t1;
50 connection master;
51 save_master_pos;
52 connection slave;
53 # Bug was that when the INSERT terminated on slave,
54 # the slave SQL thread got killed by OPTIMIZE.
55 sync_with_master; # won't work if slave SQL thread stopped
56
57 connection master; # cleanup
58 drop table t1;
59 sync_slave_with_master;
60
61 # If the machine is so fast that slave syncs before OPTIMIZE
62 # starts, this test will demonstrate nothing but will pass.
63
64 # End of 4.1 tests
65 --source include/rpl_end.inc