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

Interrupted CREATE OR REPLACE is written into binlog, and in a wrong format

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.9
    • Fix Version/s: 10.0.10
    • Component/s: None
    • Labels:
      None

      Description

      If CREATE OR REPLACE TABLE is interrupted by KILL QUERY, it can still be written into binary log with error code 0, which means it will cause discrepancy in master/slave data.
      Also, it can be written in a wrong way, e.g. in row-based format it can be written as a statement using a temporary table (which of course does not exist on slave), see the test case and its outcome:

      Test case (run with --repeat=N)

      --source include/master-slave.inc
      --source include/have_binlog_format_row.inc
      --source include/have_xtradb.inc
       
      --let $master_id = `SELECT CONNECTION_ID()`
      CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
      CREATE OR REPLACE TEMPORARY TABLE tmp LIKE t1;
      --send
        CREATE OR REPLACE TABLE t1 LIKE tmp;
       
      --connection master1
      let $run = 10;
      while ($run)
      {
        eval KILL QUERY $master_id;
        dec $run;
      }
      --connection master
      --error 0,ER_QUERY_INTERRUPTED
      --reap
      --error 0,ER_QUERY_INTERRUPTED
      SHOW TABLES; # To catch possible orphan ER_QUERY_INTERRUPTED
      SHOW TABLES;
      --sync_slave_with_master

      Result:

      Last_SQL_Error	Error 'Table 'test.tmp' doesn't exist' on query. Default database: 'test'. Query: 'CREATE OR REPLACE TABLE t1 LIKE tmp'

      Binlog:

      #140314  3:29:14 server id 1  end_log_pos 459 	Query	thread_id=8	exec_time=1	error_code=0
      use `test`/*!*/;
      SET TIMESTAMP=1394753354/*!*/;
      SET @@session.pseudo_thread_id=8/*!*/;
      SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
      SET @@session.sql_mode=0/*!*/;
      SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
      /*!\C latin1 *//*!*/;
      SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
      SET @@session.lc_time_names=0/*!*/;
      SET @@session.collation_database=DEFAULT/*!*/;
      CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB
      /*!*/;
      # at 459
      #140314  3:29:16 server id 1  end_log_pos 497 	GTID 0-1-2
      /*!100001 SET @@session.gtid_seq_no=2*//*!*/;
      # at 497
      #140314  3:29:16 server id 1  end_log_pos 595 	Query	thread_id=8	exec_time=1	error_code=0
      SET TIMESTAMP=1394753356/*!*/;
      CREATE OR REPLACE TABLE t1 LIKE tmp
      /*!*/;
      # at 595
      #140314  3:29:17 server id 1  end_log_pos 633 	GTID 0-1-3
      /*!100001 SET @@session.gtid_seq_no=3*//*!*/;

      revision-id: sergii@pisem.net-20140312113447-l92ytjpq6x952rlv
      date: 2014-03-12 12:34:47 +0100
      build-date: 2014-03-14 03:35:49 +0400
      revno: 4049
      branch-nick: 10.0

        Attachments

          Activity

            People

            • Assignee:
              monty Michael Widenius
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: