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
#####################################
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_ndb_default.inc
14
-- source include/master-slave.inc
16
create table t1 (a int not null auto_increment primary key, b int, key(b));
17
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
18
INSERT INTO t1 (a) SELECT null FROM t1;
19
INSERT INTO t1 (a) SELECT null FROM t1;
20
INSERT INTO t1 (a) SELECT null FROM t1;
21
INSERT INTO t1 (a) SELECT null FROM t1;
22
INSERT INTO t1 (a) SELECT null FROM t1;
23
INSERT INTO t1 (a) SELECT null FROM t1;
24
INSERT INTO t1 (a) SELECT null FROM t1;
25
INSERT INTO t1 (a) SELECT null FROM t1;
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;
32
# a few updates to force OPTIMIZE to do something
33
update t1 set b=(a/2*rand());
35
delete from t1 order by b limit 10000;
44
# Bug was that when the INSERT terminated on slave,
45
# the slave SQL thread got killed by OPTIMIZE.
46
sync_with_master; # won't work if slave SQL thread stopped
48
connection master; # cleanup
53
# If the machine is so fast that slave syncs before OPTIMIZE
54
# starts, this test wil demonstrate nothing but will pass.