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

Missed statement rollback in case transaction drops or create temporary table

Details

    Description

      Consider the following test case (based on real life issue and simplified by Elkin):

      CREATE TABLE `ti_pk` (
      `a` int(11) NOT NULL,
      `b` int(11) DEFAULT NULL,
      PRIMARY KEY (`a`)
      ) ENGINE=InnoDB;
       
      # for the MIXED binlog format version of the bug (and it exists with ROW format as well) the direct logging needs to be non-default
      set @@session.binlog_direct_non_transactional_updates=1;
      set @@binlog_format=mixed;
      # Bug
      begin;
      DROP TEMPORARY TABLE IF EXISTS `tmp_0`;
      CREATE TEMPORARY TABLE tmp_0 (a int primary key);
      insert into tmp_0 set a=1;
      INSERT into ti_pk select a,1 from tmp_0;
      INSERT into ti_pk set a=3;
      # --error
      INSERT into ti_pk values (2,1),(3,2) /* hit the dup key by the 2nd row */;
       
      commit;
      show binlog events; /* a=2 ROW event is there */
      

      You should get error upon INSERT, but the event that causes the problem is in the binary log. Now check this output on master vs slave:

      select count(*) = 0 from ti_pk where a = 2;
      

      Slave is already out of sync and on every next event it may easily break/hit error that does not happen on master.

      Attachments

        Activity

          Added a few comments to 7c318a6. Looks good otherwise to me!

          bnestere Brandon Nesterenko added a comment - Added a few comments to 7c318a6 . Looks good otherwise to me!

          d155769 approved to push

          bnestere Brandon Nesterenko added a comment - d155769 approved to push
          Elkin Andrei Elkin added a comment -

          To resolve conflicts at merging
          10.2->10.3 use bb-10.3-MDEV-26833-andrei,
          10.4 > 10.5 use bb-10.5MDEV-26833-andrei.

          Elkin Andrei Elkin added a comment - To resolve conflicts at merging 10.2->10.3 use bb-10.3- MDEV-26833 -andrei, 10.4 > 10.5 use bb-10.5 MDEV-26833 -andrei.

          Why don't we see this bug mentioned in the release notes and even changelogs for the versions where it is supposed to be fixed. It was a blocker!

          valerii Valerii Kravchuk added a comment - Why don't we see this bug mentioned in the release notes and even changelogs for the versions where it is supposed to be fixed. It was a blocker!
          alice Alice Sherepa added a comment -

          valerii it is in changelogs in 10.2.41 https://mariadb.com/kb/en/mariadb-10241-changelog/ - and in 10.3+ it has "Includes all fixes from MariaDB 10.2.41"

          alice Alice Sherepa added a comment - valerii it is in changelogs in 10.2.41 https://mariadb.com/kb/en/mariadb-10241-changelog/ - and in 10.3+ it has "Includes all fixes from MariaDB 10.2.41"

          People

            Elkin Andrei Elkin
            valerii Valerii Kravchuk
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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