Bug #21281 | Pending write lock is incorrectly removed when its statement being KILLed | ||
---|---|---|---|
Submitted: | 25 Jul 2006 18:07 | Modified: | 25 Aug 2007 16:07 |
Reporter: | Kolbe Kegel | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Locking | Severity: | S3 (Non-critical) |
Version: | 4.1.19, 5.0.40 | OS: | Linux (Linux) |
Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
Tags: | bfsm_2007_05_31, bfsm_2007_06_21, rt_q1_2007 |
[25 Jul 2006 18:07]
Kolbe Kegel
[1 Aug 2007 15:48]
Dmitry Lenev
Actually this problem affects not only INSERT ... ON DUPLICATE KEY UPDATE but any statement that tries to take normal write lock on the table (i.e. write lock which is not low-priority write lock and not concurrent insert write lock). So REPLACE, UPDATE and DELETE statements are affected as well.
[1 Aug 2007 15:53]
Dmitry Lenev
To reflect this I have changed bug's synopsis.
[2 Aug 2007 5:51]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/31996 ChangeSet@1.2575, 2007-08-02 09:56:00+04:00, dlenev@mockturtle.local +3 -0 Proposed fix for bug #21281 "Pending write lock is incorrectly removed when its statement being KILLed". When statement which was trying to obtain write lock on then table and which was blocked by existing read lock was killed, concurrent statements that were trying to obtain read locks on the same table and that were blocked by the presence of this pending write lock were not woken up and had to wait until this first read lock goes away. This problem was caused by the fact that we forgot to wake up threads which pending requests could have been satisfied after removing lock request for the killed thread. The patch solves the problem by waking up those threads in such situation. Questions for reviewers are marked by QQ. QQ: Should we fix this bug in 5.0 ?
[5 Aug 2007 9:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/32114 ChangeSet@1.2489, 2007-08-05 13:17:07+04:00, dlenev@mockturtle.local +1 -0 Fix for bug #21281 "Pending write lock is incorrectly removed when its statement being KILLed". When statement which was trying to obtain write lock on then table and which was blocked by existing read lock was killed, concurrent statements that were trying to obtain read locks on the same table and that were blocked by the presence of this pending write lock were not woken up and had to wait until this first read lock goes away. This problem was caused by the fact that we forgot to wake up threads which pending requests could have been satisfied after removing lock request for the killed thread. The patch solves the problem by waking up those threads in such situation. Test for this bug will be added to 5.1 only as it has much better facilities for its implementation. Particularly, by using I_S.PROCESSLIST and wait_condition.inc script we can wait until thread will be blocked on certain table lock without relying on unconditional sleep (which usage increases time needed for test runs and might cause spurious test failures on slower platforms).
[5 Aug 2007 9:50]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/32116 ChangeSet@1.2576, 2007-08-05 13:55:37+04:00, dlenev@mockturtle.local +2 -0 Added test for bug #21281 "Pending write lock is incorrectly removed when its statement being KILLed". The bug itself was fixed by separate patch in 5.0 tree.
[9 Aug 2007 13:17]
Bugs System
Pushed into 5.0.48
[9 Aug 2007 13:18]
Bugs System
Pushed into 5.1.22-beta
[25 Aug 2007 16:07]
Paul DuBois
Noted in 5.0.48, 5.1.22 changelogs. Read lock requests that were blocked by a pending write lock request were not allowed to proceed if the statement requesting the write lock was killed.