1include/rpl_init.inc [topology=1->2]
2connection server_1;
3FLUSH TABLES;
4ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
5connection server_2;
6SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
7SET @save_slave_parallel_mode= @@GLOBAL.slave_parallel_mode;
8include/stop_slave.inc
9SET GLOBAL slave_parallel_threads=2;
10SET GLOBAL slave_parallel_mode=optimistic;
11include/start_slave.inc
12connection server_1;
13CREATE TABLE t1(a INT) ENGINE=INNODB;
14OPTIMIZE TABLE t1;
15Table	Op	Msg_type	Msg_text
16test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
17test.t1	optimize	status	OK
18INSERT INTO t1 VALUES(1);
19INSERT INTO t1  SELECT 1+a FROM t1;
20INSERT INTO t1  SELECT 2+a FROM t1;
21connection server_2;
22#
23# Verify that following admin commands are marked as ddl
24# 'OPTIMIZE TABLE', 'REPAIR TABLE' and 'ANALYZE TABLE'
25#
26connection server_1;
27OPTIMIZE TABLE t1;
28Table	Op	Msg_type	Msg_text
29test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
30test.t1	optimize	status	OK
31REPAIR TABLE t1;
32Table	Op	Msg_type	Msg_text
33test.t1	repair	note	The storage engine for the table doesn't support repair
34ANALYZE TABLE t1;
35Table	Op	Msg_type	Msg_text
36test.t1	analyze	status	Engine-independent statistics collected
37test.t1	analyze	status	OK
38FLUSH LOGS;
39FOUND 1 /GTID 0-1-8 ddl/ in mysqlbinlog.out
40FOUND 1 /GTID 0-1-9 ddl/ in mysqlbinlog.out
41FOUND 1 /GTID 0-1-10 ddl/ in mysqlbinlog.out
42#
43# Clean up
44#
45DROP TABLE t1;
46connection server_2;
47FLUSH LOGS;
48#
49# Check that ALTER TABLE commands with ANALYZE, OPTIMIZE and REPAIR on
50# partitions will be marked as DDL in binary log.
51#
52connection server_1;
53CREATE TABLE t1(id INT) PARTITION BY RANGE (id) (PARTITION p0 VALUES LESS THAN (100),
54PARTITION pmax VALUES LESS THAN (MAXVALUE));
55INSERT INTO t1 VALUES (1), (10), (100), (1000);
56ALTER TABLE t1 ANALYZE PARTITION p0;
57Table	Op	Msg_type	Msg_text
58test.t1	analyze	status	Engine-independent statistics collected
59test.t1	analyze	status	OK
60ALTER TABLE t1 OPTIMIZE PARTITION p0;
61Table	Op	Msg_type	Msg_text
62test.t1	optimize	status	OK
63ALTER TABLE t1 REPAIR PARTITION p0;
64Table	Op	Msg_type	Msg_text
65test.t1	repair	status	OK
66FLUSH LOGS;
67FOUND 1 /GTID 0-1-14 ddl/ in mysqlbinlog.out
68FOUND 1 /GTID 0-1-15 ddl/ in mysqlbinlog.out
69FOUND 1 /GTID 0-1-16 ddl/ in mysqlbinlog.out
70#
71# Clean up
72#
73DROP TABLE t1;
74connection server_2;
75include/stop_slave.inc
76SET GLOBAL slave_parallel_threads= @save_slave_parallel_threads;
77SET GLOBAL slave_parallel_mode= @save_slave_parallel_mode;
78include/start_slave.inc
79include/rpl_end.inc
80