Jong-Hyuk wrote:
I've checked in a fix for this. Creating a new transaction for every search operation would add a fair amount of overhead, so I've allocated long-lived per-thread transactions instead (similar to the way locker IDs are being re-used). We can't just replace the existing lockerID mechanism with these transactions, because the intended lifetimes of their locks are not the same. Anyway, I think this should finally resolve the deadlock issues.
Please test...
Looks like we are heading to a right direction. One thing to note is that there's currently no retry mechanism provided for the added transaction. Also lacks the retry mechanism is bdb_cache_db_relock() itself. If it is selected as a victim to resolve a deadlock, it needs to restart the op if it's a write op, or it needs to restart the locking transaction if it's a read op.
Also, I still suspect that we need to protect db ops in a search op in order to insure deadlock freedom (http://www.sleepycat.com/docs/ref/lock/notxn.html), although it might be costly.