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

Innodb_deadlocks status variable counts wrong

    XMLWordPrintable

Details

    Description

      When I provoke ONE deadlock the Innodb_deadlocks status counter is increase by TWO. This oversubscribes the number of deadlocks happening in a mariadb database.

      Documentation states: Total number of InnoDB deadlocks.
      https://mariadb.com/kb/en/innodb-status-variables/#innodb_deadlocks

      So IMHO it should be 1 and not 2.

      Reproducible:

      SQL> SHOW GLOBAL STATUS LIKE '%dead%';
      +------------------+-------+
      | Variable_name    | Value |
      +------------------+-------+
      | Innodb_deadlocks | 0     |
      +------------------+-------+
       
      Session 1> START TRANSACTION;
      Session 2> START TRANSACTION;
      Session 1> UPDATE test SET data = 'bla' WHERE id = 2;
      Session 2> UPDATE test SET data = 'bla' WHERE id = 1524;
      Session 1> UPDATE test SET data = 'bla' WHERE id = 1524;
      Session 2> UPDATE test SET data = 'bla' WHERE id = 2;
       
      SQL> SHOW GLOBAL STATUS LIKE '%dead%';
      +------------------+-------+
      | Variable_name    | Value |
      +------------------+-------+
      | Innodb_deadlocks | 2     |
      +------------------+-------+
      

      Table:

      CREATE TABLE `test` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `data` varchar(128) DEFAULT NULL,
        `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
        PRIMARY KEY (`id`)
      );
      

      Data:

      INSERT INTO test SELECT NULL, 'Some data', NOW();
      INSERT INTO test SELECT NULL, 'Some data', NOW() FROM test;
      ...
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              oli Oli Sennhauser
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.