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

If two transactions concurrently execute updates on the same row, the transaction that performs the update later will fail in its attempt to modify that specific row.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.11.2
    • None
    • None
    • Ubuntu 20.04

    Description

      Under the Read Committed isolation level, if two transactions concurrently execute updates on the same row, the transaction that performs the update later will fail in its attempt to modify that specific row.

      DROP TABLE IF EXISTS mtest;
      CREATE TABLE mtest(x INT DEFAULT 0, c0 INT PRIMARY KEY, c1 INT);
      INSERT INTO mtest VALUES (0, 1, 1), (0, 99, 2);
       -- Initial Table: 
      View{
          1:[0, 1, 1]
          2:[0, 99, 2]
      }
      /* s1 */SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
      /* s1 */BEGIN;
      /* s2 */SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
      /* s2 */BEGIN;
      /* s2 */UPDATE mtest SET c0=37 WHERE c1=2;
      /* s1 */UPDATE mtest SET x = x + 10 WHERE True;(block)
      /* s2 */COMMIT;
      /* s1 */SELECT * FROM mtest;   -- Actual result:    [(10, 1, 1), (0, 37, 2)]
      -- Expected result:  [(10, 1, 1), (10, 37, 2)]  -- Both rows should have x increased by 10
      /* s1 */COMMIT;
      mysql> SELECT * FROM mtest;
      +------+----+------+
      | x    | c0 | c1   |
      +------+----+------+
      |   10 |  1 |    1 |
      |    0 | 37 |    2 |
      +------+----+------+
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            zzz nikki
            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.