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

interupted transactions in mixed mode with transactional and non-transactional tables break replication

    XMLWordPrintable

Details

    Description

      To reproduce

      Setup a usual async master - server setup

      Open 2 sessions on the master

      Execute on session 1:

      set session binlog_format =  mixed;
       
      create temporary table test.t22(a int) engine=MEMORY;
      create temporary table test.t23(a int) engine=innodb;
       
      begin;
       
       insert into test.t22(a) values(1);
       INSERT INTO test.t23 SELECT * FROM test.t22;
       SELECT SLEEP(30);
       commit;
       
      

      Kill the transaction during select sleep(30) in session 2.

      Slave breaks with error:

      Error 'Table 'test.t23' doesn't exist' on query. Default database: 'test'. Query: 'INSERT INTO test.t23 SELECT * FROM test.t22'
      

      Reason:
      --> tables are not using PKs, so statement logmode will be choosen.
      --> The interrupted transaction cause an implicit "drop temporary table"
      --> The begin... transaction will be logged into binlog with rollback,
      because transaction tables and non-transactional tables are mixed in one transaction.

      Binlog:

       
      #190903 13:42:58 server id 1  end_log_pos 614 CRC32 0x84f2060c  GTID 0-1-2 ddl
      /*!100001 SET @@session.gtid_seq_no=2*//*!*/;
      # at 614
      #190903 13:42:58 server id 1  end_log_pos 735 CRC32 0xa207f25e  Query   thread_id=15    exec_time=6     error_code=0
      SET TIMESTAMP=1567510978/*!*/;
      /*!\C utf8 *//*!*/;
      SET @@session.character_set_client=33,@@session.collation_connection=45,@@session.collation_server=33/*!*/;
      DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t23`,`t22`
      /*!*/;
      # at 735
      #190903 13:42:58 server id 1  end_log_pos 777 CRC32 0x9d1a52fd  GTID 0-1-3 ddl
      /*!100001 SET @@session.gtid_seq_no=3*//*!*/;
      BEGIN
      /*!*/;
      # at 777
      #190903 13:42:58 server id 1  end_log_pos 896 CRC32 0xfa6b3120  Query   thread_id=15    exec_time=0     error_code=0
      SET TIMESTAMP=1567510978/*!*/;
      /*!\C utf8mb4 *//*!*/;
      SET @@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=33/*!*/;
      create temporary table test.t23(a int) engine=innodb
      /*!*/;
      # at 896
      #190903 13:42:58 server id 1  end_log_pos 996 CRC32 0x8e6e177a  Query   thread_id=15    exec_time=0     error_code=0
      SET TIMESTAMP=1567510978/*!*/;
      insert into test.t22(a) values(1)
      /*!*/;
      # at 996
      #190903 13:42:58 server id 1  end_log_pos 1106 CRC32 0x08d4bda9         Query   thread_id=15    exec_time=0     error_code=0
      SET TIMESTAMP=1567510978/*!*/;
      INSERT INTO test.t23 SELECT * FROM test.t22
      /*!*/;
      # at 1106
      #190903 13:42:58 server id 1  end_log_pos 1181 CRC32 0x2ef6d902         Query   thread_id=15    exec_time=6     error_code=0
      SET TIMESTAMP=1567510978/*!*/;
      ROLLBACK
      /*!*/;
      DELIMITER ;
      # End of log file
      ROLLBACK /* added by mysqlbinlog */;
      
      

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              Richard Richard Stracke
              Votes:
              1 Vote for this issue
              Watchers:
              7 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.