From 90f2c822469a4f88f882ba8974e790f0fb0b2702 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 5 Oct 2015 16:09:21 +0500 Subject: MDEV-7817 ALTER TABLE {ADD|DROP} INDEX IF [NOT] EXISTS does not get written into binlog if nothing to do. Just log the ALTER statement even if there's nothing to do. --- mysql-test/r/create_drop_binlog.result | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result index c5d66613aed..537a1bd4605 100644 --- a/mysql-test/r/create_drop_binlog.result +++ b/mysql-test/r/create_drop_binlog.result @@ -345,3 +345,48 @@ RESET MASTER; SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 +CREATE TABLE t1(a INT, b INT); +CREATE TABLE IF NOT EXISTS t1(a INT, b INT); +Warnings: +Note 1050 Table 't1' already exists +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +Warnings: +Note 1061 Duplicate key name 'i1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP INDEX IF EXISTS i1 ON t1; +DROP INDEX IF EXISTS i1 ON t1; +Warnings: +Note 1091 Can't DROP 'i1'; check that column/key exists +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP INDEX IF EXISTS i1 ON t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP INDEX IF EXISTS i1 ON t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +RESET MASTER; -- cgit v1.2.1