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

Table_lock_waited is not counted if table is write locked

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 10.1.7
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      CentOS 6.7

      Description

      Hi,

      table_lock_waited is not increased if an INSERT has to wait for a lock table. Reproduce:
      1. LOCK TABLE a WRITE;
      2. other thread: insert into table a
      3. First thread: unlock tables;
      4. Observe: SHOW GLOBAL status LIKE 'table_locks_waited';

      Command output:

      
      MariaDB [hello]> show create table a;
      +-------+----------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                           |
      +-------+----------------------------------------------------------------------------------------------------------------------------------------+
      | a     | CREATE TABLE `a` (
        `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
        UNIQUE KEY `id` (`id`)
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
      +-------+----------------------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      
      MariaDB [hello]> lock table a write;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [hello]> 
      [2]+  Stopped                 mysql
      [root@galera1 my.cnf.d]# fg 1
      mysql
      
      MariaDB [hello]> insert into a values(null);
      
      
      
      
      ^Z
      [1]+  Stopped                 mysql
      [root@galera1 my.cnf.d]# fg 2
      mysql
      
      MariaDB [hello]> unlock tables;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [hello]> show global status like 'table_lock%';
      +-----------------------+-------+
      | Variable_name         | Value |
      +-----------------------+-------+
      | Table_locks_immediate | 26    |
      | Table_locks_waited    | 0     |
      +-----------------------+-------+
      2 rows in set (0.00 sec)
      
      MariaDB [hello]> 
      
      mysql  Ver 15.1 Distrib 10.1.7-MariaDB, for Linux (x86_64) using readline 5.1
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                Unassigned
                Reporter:
                michaeldg Michaƫl de groot
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: