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

Unexpected deadlock when one of the two transactions does not acquire any locks

    XMLWordPrintable

Details

    Description

      Isolation Level: Repeatable Read & Serializable

      DELETE statement does not acquire any locks, but deadlock occurs when "UPDATE t SET c1=1 WHERE 3;" executes, resulting in incorrect final database state.

      /*init*/ CREATE TABLE t(c1 INT PRIMARY KEY);
      /*init*/ INSERT INTO t(c1) VALUES (3);
       
      /* t1 */ BEGIN;
      /* t1 */ UPDATE t SET c1=2 WHERE -5;
      /* t2 */ BEGIN;
      /* t2 */ DELETE FROM t WHERE -3;  -- blocked
      /* t1 */ UPDATE t SET c1=1 WHERE 3;
      /* t2 */ Error 1213: Deadlock found when trying to get lock; try restarting transaction
      /* t1 */ COMMIT;
      /* t2 */ COMMIT;
      /* t2 */ SELECT * FROM t;  -- [(1)]
      

      We expect deadlock not to occur, and the final database state to be [ ].

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              uniqueR Ryan
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.