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

Deadlocks happen often when updating different rows

    XMLWordPrintable

Details

    Description

      The following deadlock error happens so often that it's driving me and our customers crazy:
      SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction.

      I didn't have this issue so often before upgrading to MariaDB 10.2
      I can see what queries cause Deadlock by pt-deadlock-logger, and they're never on the same record, two different records, having different data cause the issue.

      server ts user db tbl idx lock_type lock_mode wait_hold victim query
      db1 2018-10-28T12:38:08 user1 db tbl1 PRIMARY RECORD S w 1 UPDATE `db`.`tbl1` SET `plan` = 'bronze', `price` = 790000, `modified` = '2018-10-28 12:38:08' WHERE `db`.`tbl1`.`id` = 152216
      db1 2018-10-28T12:38:08 user2 db tbl1 PRIMARY RECORD S w 0 UPDATE tbl1 SET employer_id = 15104 , modified = '2018-10-28 12:38:08' WHERE id = 152198

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              akalantari Ali Kalantari
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.