Bug #81348 table_locks_waited not updated in MySQL 5.7
Submitted: 8 May 2016 16:52 Modified: 10 May 2016 15:41
Reporter: Peter Zaitsev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[8 May 2016 16:52] Peter Zaitsev
Description:
It does not look like table_locks_waited is properly updated in MySQL 5.7

Running sysbench on MyISAM  I see

|  464 | sbtest | localhost | myisam | Query   |    5 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE                                                                            |         0 |             0 |
|  465 | sbtest | localhost | myisam | Query   |    4 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE                                                                            |         0 |             0 |
|  466 | sbtest | localhost | myisam | Query   |    5 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE                                                                            |         0 |             0 |
|  467 | sbtest | localhost | myisam | Query   |    4 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE                                                                            |         0 |             0 |
|  468 | sbtest | localhost | myisam | Query   |    4 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE                                                                            |         0 |             0 |
|  469 | sbtest | localhost | myisam | Query   |    4 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE                                                                            |         0 |             0 |
|  470 | sbtest | localhost | myisam | Query   |    4 | Waiting for table metadata lock | LOCK TABLES sbtest1 WRITE 

Yet:

mysql> show global status like "%table_lock%";
+-----------------------------------------+--------+
| Variable_name                           | Value  |
+-----------------------------------------+--------+
| Performance_schema_table_lock_stat_lost | 0      |
| Table_locks_immediate                   | 207780 |
| Table_locks_waited                      | 0      |
+-----------------------------------------+--------+
3 rows in set (0.00 sec)

Looks like this status  is no longer updated at least with lock tables caused locks.

How to repeat:
See Above
[10 May 2016 15:41] MySQL Verification Team
Pjotr,

I have tested it and it proves that you are right. 

It is low priority verified bug.