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 /mysys/thr_lock.c | |
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 'mysys/thr_lock.c')
-rw-r--r-- | mysys/thr_lock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 7f7be4835a5..afe8f289089 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -405,6 +405,8 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, wait->last= &data->next; } + statistic_increment(locks_waited, &THR_LOCK_lock); + /* Set up control struct to allow others to abort locks */ thread_var->current_mutex= &data->lock->mutex; thread_var->current_cond= cond; @@ -469,7 +471,6 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, else { result= THR_LOCK_SUCCESS; - statistic_increment(locks_waited, &THR_LOCK_lock); if (data->lock->get_status) (*data->lock->get_status)(data->status_param, 0); check_locks(data->lock,"got wait_for_lock",0); |