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

RBR fails with "Can't find record in" after failing to create temporary table within transaction

    XMLWordPrintable

Details

    Description

      Note: In the test case below, the extreme MAXVALUE=2 is not specific to the failure, it is just there to make the test case shorter. It can be any value as long as the sequence runs out of values by the time the temporary table creation attempt uses it.

      --source include/have_innodb.inc
      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
       
      CREATE TABLE t (a INT) ENGINE=InnoDB;
      CREATE SEQUENCE s MINVALUE=1 MAXVALUE=2 ENGINE=InnoDB;
      SELECT NEXTVAL(s), NEXTVAL(s);
      START TRANSACTION;
      INSERT INTO t VALUES (1),(2);
      --error ER_SEQUENCE_RUN_OUT
      CREATE TEMPORARY TABLE tmp AS SELECT NEXTVAL(s);
      UPDATE t tb1 SET a = 3;
      CREATE TEMPORARY TABLE tmp AS SELECT 1;
      COMMIT;
       
      --sync_slave_with_master
       
      # Cleanup
      --connection master
      DROP SEQUENCE s;
      DROP TABLE t;
      --source include/rpl_end.inc
      

      11.6 d8dad8c3b54cd09fefce7bc3b9749f427eed9709

      Last_SQL_Error	Could not execute Update_rows_v1 event on table test.t; Can't find record in 't', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000001, end_log_pos 0
      

      The problem is that while on the primary the failed attempt to create the table does not roll back the transaction, values previously inserted into t table stay inserted, and UPDATE modifies them, the INSERT (that is, write row events) are not written into the binary log, instead the transaction in the binary log begins with UPDATE and thus refers to rows not existing on the replica.

      The failure started happening after this commit in 11.5:

      commit 381e9adb6cf838a30da6cf3bcd359ef9ebc3d575
      Author: Monty
      Date:   Fri May 17 13:42:55 2024 +0300
       
          MDEV-34150 Assertion failure in Diagnostics_area::set_error_status upon binary logging hitting tmp space limit
      

      Unfortunately I missed it during MDEV-9101 testing. Due to the amount of existing bugs leading to "Can't find record" errors, they are usually recognized as a known issue and get ignored. Sometimes it leads to false negatives.

      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.