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

Incorrect result for locking reads after INSERT of another transaction

    XMLWordPrintable

Details

    Description

      How to repeat:

      /* init */ CREATE TABLE t(a INT PRIMARY KEY);
      /* t1 */ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
      /* t2 */ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
       
      /* t1 */ BEGIN;
      /* t2 */ BEGIN;
      /* t1 */ INSERT INTO t(a) VALUES (2);
      /* t2 */ SELECT a FROM t FOR UPDATE;  -- actual: [2], expected: [1, 2]
      /* t1 */ INSERT INTO t(a) VALUES (1);
      /* t1 */ COMMIT;
      /* t2 */ COMMIT;
      

      The SELECT FOR UPDATE statement of t2 was initially blocked by t1. It recovered after t1's COMMIT, but its query result only contained record (2), even though in innodb_snapshot_isolation=ON mode. Interestingly, swapping the order of the two INSERT statements for t1 eliminates this anomaly.

      Attachments

        Activity

          People

            vlad.lesin Vladislav Lesin (Inactive)
            zhuangliu Zhuang Liu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 3.25h
                3.25h

                Git Integration

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