diff options
author | unknown <davi@mysql.com/endora.local> | 2008-01-28 10:52:41 -0200 |
---|---|---|
committer | unknown <davi@mysql.com/endora.local> | 2008-01-28 10:52:41 -0200 |
commit | 3d5e32b27d35655ab509f5567be7eeda58418052 (patch) | |
tree | eb13b53670327ef9ba649f2f2999242d099b0310 /mysql-test/t/lock_multi.test | |
parent | 8f9e655dab1802d31be5c01ea5b5e9ccee01363c (diff) | |
download | mariadb-git-3d5e32b27d35655ab509f5567be7eeda58418052.tar.gz |
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.
Diffstat (limited to 'mysql-test/t/lock_multi.test')
-rw-r--r-- | mysql-test/t/lock_multi.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 0d36b79df78..c73ebab056e 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -439,4 +439,30 @@ connection default; disconnect flush; drop table t1; +# +# Bug#30331: Table_locks_waited shows inaccurate values +# + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +create table t1 (a int); +flush status; +lock tables t1 read; +show status like 'Table_locks_waited'; +connect (waiter,localhost,root,,); +connection waiter; +--send insert into t1 values(1); +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Locked" and info = "insert into t1 values(1)"; +--source include/wait_condition.inc +drop table t1; +disconnect waiter; +connection default; +show status like 'Table_locks_waited'; +#show global status like "Table_locks_waited"; + --echo End of 5.1 tests |