Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-1632

LP #1466414: Deadlocks missed by INFORMATION_SCHEMA.INNODB_METRICS lock_deadlocks counter

    Details

      Description

      **Reported in Launchpad by Laurynas Biveinis last update 26-05-2016 14:20:36

      Copy of http://bugs.mysql.com/bug.php?id=77399 (the testcase is based on percona_innodb_deadlock_count with I_S.I_M support added)

      [18 Jun 8:22] Laurynas Biveinis
      Description:
      Some deadlocks do not bump the INFORMATION_SCHEMA.INNODB_METRICS lock_deadlocks counter. The MTR below will result in

      SELECT NAME, COUNT, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="lock_deadlocks";
      NAME COUNT COMMENT
      lock_deadlocks 0 Number of deadlocks

      But if you check ie. engine status, you will see

      ------------------------
      LATEST DETECTED DEADLOCK
      ------------------------
      2015-06-18 11:20:16 10d7a0000

          • (1) TRANSACTION:
            TRANSACTION 1292, ACTIVE 0 sec starting index read
            ... info ...

      How to repeat:
      --source include/have_innodb.inc

      connect (con1,localhost,root,,);
      connect (con2,localhost,root,,);

      create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
      insert into t values(2,1);
      insert into t values(1,2);

      SET GLOBAL innodb_monitor_reset=lock_deadlocks;

      connection con1;
      BEGIN; SELECT b FROM t WHERE a=1 FOR UPDATE;

      connection con2;
      BEGIN; SELECT b FROM t WHERE a=2 FOR UPDATE;

      connection con1;
      SEND SELECT b FROM t WHERE a=2 FOR UPDATE;

      connection con2;
      SEND SELECT b FROM t WHERE a=1 FOR UPDATE;

      connection con1;
      --error 0,ER_LOCK_DEADLOCK
      reap;
      ROLLBACK;

      connection con2;
      --error 0,ER_LOCK_DEADLOCK
      reap;
      ROLLBACK;

      connection default;

      SELECT NAME, COUNT, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="lock_deadlocks";

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                laurynas.biveinis Laurynas Biveinis (Inactive)
                Reporter:
                lpjirasync lpjirasync (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: