1SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment;
2SET @innodb_optimize_fulltext_orig=@@GLOBAL.innodb_optimize_fulltext_only;
3SET GLOBAL innodb_defragment = 1;
4SET GLOBAL innodb_optimize_fulltext_only = 0;
5#
6# MDEV-12198 innodb_defragment=1 crashes server on
7# OPTIMIZE TABLE when FULLTEXT index exists
8#
9CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256),
10KEY(a, b), FULLTEXT KEY(b)) ENGINE=INNODB;
11OPTIMIZE TABLE t1;
12Table	Op	Msg_type	Msg_text
13test.t1	optimize	status	OK
14INSERT INTO t1 VALUES (100000, REPEAT('A', 256));
15INSERT INTO t1 VALUES (200000, REPEAT('A', 256));
16INSERT INTO t1 VALUES (300000, REPEAT('A', 256));
17INSERT INTO t1 VALUES (400000, REPEAT('A', 256));
18OPTIMIZE TABLE t1;
19Table	Op	Msg_type	Msg_text
20test.t1	optimize	status	OK
21#
22# MDEV-15824 innodb_defragment=ON trumps
23# innodb_optimize_fulltext_only=ON in OPTIMIZE TABLE
24#
25SET GLOBAL innodb_optimize_fulltext_only = 1;
26OPTIMIZE TABLE t1;
27Table	Op	Msg_type	Msg_text
28test.t1	optimize	status	OK
29SET GLOBAL innodb_defragment = 0;
30OPTIMIZE TABLE t1;
31Table	Op	Msg_type	Msg_text
32test.t1	optimize	status	OK
33DROP TABLE t1;
34CREATE TABLE t1 (c POINT PRIMARY KEY, SPATIAL INDEX(c)) ENGINE=InnoDB;
35OPTIMIZE TABLE t1;
36Table	Op	Msg_type	Msg_text
37test.t1	optimize	status	OK
38DROP TABLE t1;
39SET GLOBAL innodb_defragment = @innodb_defragment_orig;
40SET GLOBAL innodb_optimize_fulltext_only = @innodb_optimize_fulltext_orig;
41