diff options
author | Andrei <andrei.elkin@mariadb.com> | 2021-12-17 00:17:03 +0200 |
---|---|---|
committer | Andrei <andrei.elkin@mariadb.com> | 2021-12-17 20:14:40 +0200 |
commit | aba7ec58bb0cc72d85a57c5e3aa23acc18213b36 (patch) | |
tree | 859d2e230a462d3f571e59115e4c275f43eb8b1a | |
parent | 5709ea72ccd1087d023d3f792aa09365fddf7262 (diff) | |
download | mariadb-git-aba7ec58bb0cc72d85a57c5e3aa23acc18213b36.tar.gz |
Fixing a QA find of OPTIMIZE asserts.
Fixed with not letting into SA binlog function as OPTIMIZE
tries entering inadvertently (having binlogging capabilities
temporarily turned off).
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_start_alter_optimize.result | 18 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_start_alter_optimize.test | 25 | ||||
-rw-r--r-- | sql/log.cc | 3 |
3 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_optimize.result b/mysql-test/suite/rpl/r/rpl_start_alter_optimize.result new file mode 100644 index 00000000000..796669ff570 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_start_alter_optimize.result @@ -0,0 +1,18 @@ +include/master-slave.inc +[connection master] +connection master; +set binlog_alter_two_phase=YES; +connection master; +CREATE TABLE t1 (i int) engine=innodb; +CREATE TABLE t2 (i int) engine=innodb; +ALTER TABLE t1 DROP CONSTRAINT IF EXISTS y; +Warnings: +Note 1091 Can't DROP CONSTRAINT `y`; check that it exists +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +connection slave; +connection master; +drop table t1,t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_optimize.test b/mysql-test/suite/rpl/t/rpl_start_alter_optimize.test new file mode 100644 index 00000000000..32c7a61d2a6 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_start_alter_optimize.test @@ -0,0 +1,25 @@ +# MDEV-11675 two phase logged ALTER +# +# The tests verifies execution of non-ALTER queries that are handled +# through mysql_alter_table function. + +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection master +set binlog_alter_two_phase=YES; + +--connection master +CREATE TABLE t1 (i int) engine=innodb; +CREATE TABLE t2 (i int) engine=innodb; + +ALTER TABLE t1 DROP CONSTRAINT IF EXISTS y; +OPTIMIZE TABLE t2; + +--sync_slave_with_master + +--connection master +drop table t1,t2; + +--source include/rpl_end.inc diff --git a/sql/log.cc b/sql/log.cc index 14683461ba9..4508b4808fb 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -600,6 +600,9 @@ bool write_bin_log_start_alter(THD *thd, bool& partial_alter, uint64 start_alter_id, bool if_exists) { #if defined(HAVE_REPLICATION) + if (!(thd->variables.option_bits & OPTION_BIN_LOG)) + return false; + if (start_alter_id) { if (thd->rgi_slave->get_finish_event_group_called()) |