mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug#30331 Table_locks_waited shows inaccurate values
The problem is that the Table_locks_waited was incremented only when the lock request succeed. If a thread waiting for the lock gets killed or the lock request is aborted, the variable would not be incremented, leading to inaccurate values in the variable. The solution is to increment the Table_locks_waited whenever the lock request is queued. This reflects better the intended behavior of the variable -- show how many times a lock was waited. mysql-test/r/lock_multi.result: Add test case result for Bug#30331 mysql-test/t/lock_multi.test: Add test case for Bug#30331 mysys/thr_lock.c: Increment locks_waited whenever the thread is supposed to wait for the lock.
This commit is contained in:
@@ -143,4 +143,16 @@ connection: default
|
||||
flush tables;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
lock tables t1 read;
|
||||
show status like 'Table_locks_waited';
|
||||
Variable_name Value
|
||||
Table_locks_waited 0
|
||||
insert into t1 values(1);;
|
||||
drop table t1;
|
||||
show status like 'Table_locks_waited';
|
||||
Variable_name Value
|
||||
Table_locks_waited 1
|
||||
End of 5.1 tests
|
||||
|
||||
Reference in New Issue
Block a user