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

DROP TABLE generated after half-failed CREATE OR REPLACE can break replication

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.0
    • Fix Version/s: 10.1, 10.0
    • Component/s: Replication
    • Labels:

      Description

      When CREATE OR REPLACE TABLE fails after dropping the table, a special DROP TABLE is automatically written in the binary log.
      It causes data inconsistency between master and slave in the following scenario:

      • table t1 is created;
      • temporary table t1 is created and written to the binary log in statement format;
      • create or replace table t1 drops the base table t1 and then fails;
      • drop table t1 is generated written to the binary log;
      • on slave, it drops the temporary table, while on the master the temporary table exists and the base table is not.
      Test case
      
      --source include/have_binlog_format_mixed.inc
      --source include/master-slave.inc
      
      --enable_connect_log
      
      --let $con0 = `select connection_id()`
      create table t1 (i int);
      create table t2 like t1;
      insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8);
      insert into t1 select t1a.* from t1 t1a, t1 t1b, t1 t1c, t1 t1d, t1 t1e, t1 t1f;
      
      create temporary table t2 as select 1;
      send create or replace table t2 as select * from t1;
      
      --connection master1
      
      --let $show_statement= SHOW PROCESSLIST
      --let $field= State
      --let $condition= = 'Sending data'
      --source include/wait_show_condition.inc
      
      eval kill query $con0;
      
      --connection master
      --error ER_QUERY_INTERRUPTED
      --reap
      
      show tables;
      
      --sync_slave_with_master
      
      show tables;
      drop table if exists t1, t2;
      
      
      --connection master
      drop table if exists t1, t2;
      
      --disable_connect_log
      --source include/rpl_end.inc
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated: