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

CREATE TABLE is not written in binary log if connection is killed in the process

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.0.0, 5.5.28a
    • 5.5
    • None

    Description

      The problem is also reproducible on MySQL 5.5, 5.6 and filed as http://bugs.mysql.com/bug.php?id=67942

      If a connection running CREATE TABLE .. LIKE is killed at a certain moment, it might happen that the table is created, but the corresponding record is not written to the binary log. Naturally, further actions on the table cause replication failure.

      I'm not sure whether it can be reproduced with plain CREATE TABLE rather than CREATE TABLE .. LIKE. With CREATE TABLE .. LIKE, I could only reproduce it when the existing table (the one under LIKE) is a temporary table, and only with RBR.

      Please note that the test case uses debug sync points. There is no need to add anything to the code, the sync point "create_table_like_before_binlog" already exists in MariaDB 5.5 and 10.0.

      Test case:

      --source include/master-slave.inc
      --source include/have_binlog_format_row.inc
       
      --connect (con1,localhost,root,,)
      --let $con1 = `SELECT CONNECTION_ID()`
       
      CREATE TEMPORARY TABLE t1 (j INT);
       
      SET DEBUG_SYNC='create_table_like_before_binlog SIGNAL want_to_binlog WAIT_FOR killed';
       
      send CREATE TABLE IF NOT EXISTS t2 LIKE t1;
       
      --connection master
       
      SET DEBUG_SYNC='now WAIT_FOR want_to_binlog';
      eval KILL $con1;
      SET DEBUG_SYNC='now SIGNAL killed';
       
      SHOW TABLES;
      SHOW BINLOG EVENTS;
      INSERT INTO t2 VALUES (1);
       
      --sync_slave_with_master
       

      Partial output:

      SHOW TABLES;
      Tables_in_test
      t2
      SHOW BINLOG EVENTS;
      Log_name        Pos     Event_type      Server_id       End_log_pos     Info
      master-bin.000001       4       Format_desc     1       245     Server ver: 5.5.28a-MariaDB-valgrind-max-debug-log, Binlog ver: 4
      master-bin.000001       245     Query   1       355     use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`
      INSERT INTO t2 VALUES (1);
      ...
      === SHOW SLAVE STATUS ===
      ...
      Last_Errno      1146
      Last_Error      Error executing row event: 'Table 'test.t2' doesn't exist'

      Attachments

        Activity

          People

            Unassigned Unassigned
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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