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

Replication failure upon operations on temporary table with create_tmp_table_binlog_formats=STATEMENT,MIXED

    XMLWordPrintable

Details

    Description

      --source include/have_binlog_format_mixed.inc
      --source include/master-slave.inc
       
      SET create_tmp_table_binlog_formats = 'STATEMENT,MIXED';
       
      CREATE TEMPORARY TABLE tmp (a INT);
      INSERT INTO tmp VALUES (1),(1);
      UPDATE IGNORE tmp SET a = 2;
      DELETE FROM tmp;
      ALTER TABLE tmp ADD PRIMARY KEY (a);
       
      SHOW BINLOG EVENTS;
       
      --sync_slave_with_master
       
      --connection master
      --source include/rpl_end.inc
      

      UPDATE and following DML is not written to the binary (not sure why, apparently IGNORE somehow makes it not eligible, although I fail to see the logic behind it); but ALTER is written, so slave attempts to add a primary key to a table which still has duplicate rows, and fails.

      main 5bcc115d773caac07d4afd42252e08f3905452b0

      Last_SQL_Errno	1062
      Last_SQL_Error	Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'ALTER TABLE tmp ADD PRIMARY KEY (a)'
       
      master-bin.000001	4	Format_desc	1	257	Server ver: 12.3.0-MariaDB-asan-debug-log, Binlog ver: 4
      master-bin.000001	257	Gtid_list	1	286	[]
      master-bin.000001	286	Binlog_checkpoint	1	330	master-bin.000001
      master-bin.000001	330	Gtid	1	372	GTID 0-1-1
      master-bin.000001	372	Query	1	482	use `test`; CREATE TEMPORARY TABLE tmp (a INT)
      master-bin.000001	482	Gtid	1	524	BEGIN GTID 0-1-2
      master-bin.000001	524	Query	1	0	use `test`; INSERT INTO tmp VALUES (1),(1)
      master-bin.000001	621	Query	1	694	COMMIT
      master-bin.000001	694	Gtid	1	736	GTID 0-1-3
      master-bin.000001	736	Query	1	847	use `test`; ALTER TABLE tmp ADD PRIMARY KEY (a)
      

      Till recently UPDATE IGNORE would cause an assertion failure on a debug build

      bb-12.2-release 75c4adf2658773705b822a518bb6f182cea37968

      sql/temporary_tables.cc:867: void THD::mark_tmp_table_as_free_for_reuse(TABLE*): Assertion `!mysql_bin_log.is_open()' failed.
      

      but the assertion was removed in the scope of MDEV-37785.

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.