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

Table_lock_waited is not counted if table is write locked

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Not a Bug
    • 10.1.7
    • N/A
    • Locking
    • None
    • 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            michaeldg Michaël de groot
            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.