Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.5.17, 10.6.12
-
None
Description
Consider the following test case involving 3 sessions. In the first one run this:
MariaDB [test]> CREATE TABLE `test` (`col` varchar(10) ) engine=InnoDB;
|
Query OK, 0 rows affected (0.106 sec)
|
|
MariaDB [test]> insert into test values ('a');
|
Query OK, 1 row affected (0.038 sec)
|
|
MariaDB [test]> select name, count,time_enabled from information_schema.innodb_metrics where name ='lock_row_lock_current_waits';
|
+-----------------------------+-------+---------------------+
|
| name | count | time_enabled |
|
+-----------------------------+-------+---------------------+
|
| lock_row_lock_current_waits | 0 | 2023-02-14 18:31:50 |
|
+-----------------------------+-------+---------------------+
|
1 row in set (0.001 sec)
|
Now, in the second one update the only row in the InnoDB table created:
MariaDB [test]> begin;update test set col='c' where col='a';
|
Query OK, 0 rows affected (0.000 sec)
|
|
Query OK, 1 row affected (0.003 sec)
|
Rows matched: 1 Changed: 1 Warnings: 0
|
In the third one run similar update that will hang waiting for 50 seconds (with default settings):
MariaDB [test]> begin;update test set col='b' where col='a';
|
Now in the first session we can see counter increased, reset it and wait a bit:
MariaDB [test]> select name, count,time_enabled from information_schema.innodb_metrics where name ='lock_row_lock_current_waits';
|
+-----------------------------+-------+---------------------+
|
| name | count | time_enabled |
|
+-----------------------------+-------+---------------------+
|
| lock_row_lock_current_waits | 1 | 2023-02-14 18:31:50 |
|
+-----------------------------+-------+---------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [test]> set global innodb_monitor_disable='lock_row_lock_current_waits';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> set global innodb_monitor_reset_all='lock_row_lock_current_waits';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> set global innodb_monitor_enable='lock_row_lock_current_waits';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> select name, count,time_enabled from information_schema.innodb_metrics where name ='lock_row_lock_current_waits';
|
+-----------------------------+-------+---------------------+
|
| name | count | time_enabled |
|
+-----------------------------+-------+---------------------+
|
| lock_row_lock_current_waits | 0 | 2023-02-15 18:19:42 |
|
+-----------------------------+-------+---------------------+
|
1 row in set (0.001 sec)
|
When we get this error message in the third session:
Query OK, 0 rows affected (0.000 sec)
|
|
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
|
MariaDB [test]>
|
in the first one we get a negative value of the counter:
MariaDB [test]> select name, count,time_enabled from information_schema.innodb_metrics where name ='lock_row_lock_current_waits';
|
+-----------------------------+-------+---------------------+
|
| name | count | time_enabled |
|
+-----------------------------+-------+---------------------+
|
| lock_row_lock_current_waits | -1 | 2023-02-15 18:19:42 |
|
+-----------------------------+-------+---------------------+
|
1 row in set (0.001 sec)
|
This is a bug and similar bugs were reported (and some fixed) many times for MySQL:
https://bugs.mysql.com/bug.php?id=73114
https://bugs.mysql.com/bug.php?id=75966
https://bugs.mysql.com/bug.php?id=81099
https://bugs.mysql.com/bug.php?id=79703
...
Attachments
Issue Links
- causes
-
MDEV-32554 mon_lock_wait_current_count test causes innodb.monitor failure
- Closed