Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7817

ALTER TABLE {ADD|DROP} INDEX IF [NOT] EXISTS does not get written into binlog if nothing to do

Details

    Description

      I add this code into an mtr test:

      CREATE TABLE t1(a INT, b INT);
      CREATE TABLE IF NOT EXISTS t1(a INT, b INT);
      CREATE INDEX IF NOT EXISTS i1 ON t1(a);
      CREATE INDEX IF NOT EXISTS i1 ON t1(a);
      SHOW CREATE TABLE t1;
      DROP INDEX IF EXISTS i1 ON t1;
      DROP INDEX IF EXISTS i1 ON t1;
      DROP TABLE t1;
      DROP TABLE IF EXISTS t1;
      --replace_column 1 # 2 # 5 #
      --replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
      SHOW BINLOG EVENTS;
      RESET MASTER;

      and see this output:

      +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`; 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;

      Notice, these queries do get logged even if nothing to do:

      • CREATE TABLE IF NOT EXISTS
      • DROP TABLE IF EXISTS

      Unlike the above, these queries do not get logged if nothing todo:

      • CREATE INDEX IF NOT EXISTS i1 ON t1(a);
      • DROP INDEX IF EXISTS i1 ON t1;
        They should be get logged.

      Attachments

        Activity

          bar Alexander Barkov created issue -
          serg Sergei Golubchik made changes -
          Field Original Value New Value
          Summary ALTER TABLE {ADD|DROP} INDEX IF [NOT] EXISTS do not get written into binlog if nothing to do ALTER TABLE {ADD|DROP} INDEX IF [NOT] EXISTS does not get written into binlog if nothing to do
          elenst Elena Stepanova made changes -
          Component/s Data Definition - Alter Table [ 10114 ]
          Affects Version/s 10.1 [ 16100 ]
          Affects Version/s 10.0 [ 16000 ]
          elenst Elena Stepanova made changes -
          Labels verified
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 60202 ] MariaDB v3 [ 66965 ]
          bar Alexander Barkov made changes -
          Assignee Alexander Barkov [ bar ]
          danblack Daniel Black added a comment -

          this might have been introduced in MDEV-7390 accidentally. sorry if this was the case.

          danblack Daniel Black added a comment - this might have been introduced in MDEV-7390 accidentally. sorry if this was the case.
          holyfoot Alexey Botchkov made changes -
          Assignee Alexey Botchkov [ holyfoot ]
          holyfoot Alexey Botchkov made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          holyfoot Alexey Botchkov added a comment - proposed patch: http://lists.askmonty.org/pipermail/commits/2015-October/008483.html


          The patch looks Ok to push.

          bar Alexander Barkov added a comment - The patch looks Ok to push.
          holyfoot Alexey Botchkov made changes -
          Assignee Alexey Botchkov [ holyfoot ] Alexander Barkov [ bar ]
          holyfoot Alexey Botchkov made changes -
          Assignee Alexander Barkov [ bar ] Alexey Botchkov [ holyfoot ]

          I belive that can be fixed in 10.0 similarly.

          holyfoot Alexey Botchkov added a comment - I belive that can be fixed in 10.0 similarly.
          holyfoot Alexey Botchkov made changes -
          Fix Version/s 10.1.8 [ 19605 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 66965 ] MariaDB v4 [ 148924 ]

          People

            holyfoot Alexey Botchkov
            bar Alexander Barkov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.