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 # Change: NDB does not and will not support
8 # OPTIMIZE for memory tables. If and when
9 # it does support for Disk Data, a new
10 # version of this test will be need.
11 # Skipping this test if default engine = ndb
12 #####################################
13 --source include/not_group_replication_plugin.inc
14 # Bug#18128323: On SLOW Solaris/WINT machines and debug
15 # builds test is failing due to timeout (if InnoDB engine).
16 # Hence, we will be using MyISAM engine as default until
17 # that issue is sorted out.
18 -- source include/force_myisam_default.inc
19 -- source include/have_myisam.inc
20 -- source include/not_ndb_default.inc
21 -- source include/master-slave.inc
22
23 disable_query_log;
24 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
25 enable_query_log;
26
27 create table t1 (a int not null auto_increment primary key, b int, key(b));
28 INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
29 --disable_warnings
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 INSERT INTO t1 (a) SELECT null FROM t1;
40 INSERT INTO t1 (a) SELECT null FROM t1;
41 INSERT INTO t1 (a) SELECT null FROM t1;
42 INSERT INTO t1 (a) SELECT null FROM t1;
43 --enable_warnings
44 save_master_pos;
45 # a few updates to force OPTIMIZE to do something
46 --disable_warnings
47 update t1 set b=(a/2*rand());
48 delete from t1 order by b limit 10000;
49 --enable_warnings
50
51 connection slave;
52 sync_with_master;
53 --disable_result_log
54 optimize table t1;
55 --enable_result_log
56 connection master;
57 save_master_pos;
58 connection slave;
59 # Bug was that when the INSERT terminated on slave,
60 # the slave SQL thread got killed by OPTIMIZE.
61 sync_with_master; # won't work if slave SQL thread stopped
62
63 connection master; # cleanup
64 drop table t1;
65 --source include/sync_slave_sql_with_master.inc
66
67 # If the machine is so fast that slave syncs before OPTIMIZE
68 # starts, this test wil demonstrate nothing but will pass.
69
70 # End of 4.1 tests
71 --source include/rpl_end.inc