Bug #35538 | Falcon three-way deadlock between scavenger, gopher and an insert | ||
---|---|---|---|
Submitted: | 24 Mar 2008 22:11 | Modified: | 8 Jan 2009 10:00 |
Reporter: | Kevin Lewis | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Falcon storage engine | Severity: | S3 (Non-critical) |
Version: | 6.04 | OS: | Any |
Assigned to: | Kevin Lewis | CPU Architecture: | Any |
[24 Mar 2008 22:11]
Kevin Lewis
[24 Mar 2008 22:14]
Kevin Lewis
Setting priority to P1 because it locks up everything. I think it happens more often than is being reported since it is hard to diagnose.
[25 Mar 2008 3:47]
Kevin Lewis
Move the call to Table::validateUpdate() up to the top of Section::updateRecord() so that it does not hold and locks on any BDBs.
[25 Mar 2008 3:55]
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/44371 ChangeSet@1.2608, 2008-03-24 22:55:03-05:00, klewis@klewis-mysql. +10 -0 Bug#35538 - Fix three-way deadlock between scavenger, gopher and an insert by moving the call to Table::validateUpdate() up to the top of Section::updateRecord() so that it does not hold any locks on any BDBs. Also, prevent an inadvertent wakeup of an active gopher thread waiting on another syncObject.
[26 Mar 2008 17:10]
Kevin Lewis
I now doubt if this is the right way to avoid the deadlock. section::updateRecord is run by a gopher thread which is about to put a record update from the serial log into a data page. Since gopher threads can run in parallel, and a change by large earlier transaction may not get applied until after a change to the same record by a short transaction, Table::validateUpdate was added to make sure that the older record does not overwrite the newer record in the page. It makes sense to hold a lock on the page while you are doing this check. Otherwise one gopher thread could check for a newer record and not find one, then find the page and write the change, only to discover that another gopher added a newer version after your check. Putting this change back into 'In Progress'.
[26 Mar 2008 18:46]
Kevin Lewis
While two concurrent gopher threads are putting sequential changes into the data page, the associated transactions are still active, not completed, so both of those record versions will be seen in the record's prior version chain. So I no longer think this solution is a problem. The only time both these record versions are not in the record chain is during recovery. Fortunately, there is only one recovery thread, which processes these in transaction completion order.
[10 Apr 2008 19:14]
Bugs System
Pushed into 6.0.5-alpha
[8 Jan 2009 10:00]
MC Brown
Internal change only. No documentation needed.