dbTalk Databases Forums  

Deadlock in read-only operations

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Deadlock in read-only operations in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Deadlock in read-only operations - 06-19-2006 , 11:09 PM






I wanted to ask if it is possible for threads using read-only cursor
operations to experience deadlocks in a transaction environment.

In the application I am working with, we have a large number of threads
doing stateless service requests. The threads create transactions, and
use the transactions to create cursors via the Java method
Database.openCursor(txn,null); It then ends up using that cursor to
find data by calling Cursor.getKeySearchRange( with a lock mode of
DB_READ_COMMITTED).

Right now the idea is to minimize the chance of deadlocks because we
have a high total # of thread reading the table. We initially had our
application updating some of the data being read, but got a high
frequence of deadlocks. We removed the updates.

One thing we are still seeing is something odd in the transactional
stats. We are still seeing the aborted transaction count go up, but to
my knowledge the only situation where we would do an abort is from the
TransactionRunner object, in the event that maximum retries is
surpassed (10). Otherwise, I can't explain the increase in aborts.
Does the statistics on transactions include commit and abort activity
not directly related to application transactions? Can an application
using transactional cursors, in a read-only manner still encounter
deadlocks?


Reply With Quote
  #2  
Old   
Ron
 
Posts: n/a

Default Re: Deadlock in read-only operations - 06-21-2006 , 03:38 PM






Hi Bob,

bob.s.walters (AT) gmail (DOT) com wrote:
Quote:
I wanted to ask if it is possible for threads using read-only cursor
operations to experience deadlocks in a transaction environment.

Deadlocks should not occur when you have ONLY read-only cursor
operations.

Can an application
Quote:
using transactional cursors, in a read-only manner still encounter
deadlocks?
This should not happen.

Are you sure you have turned off ALL update activity?

What version of Berkeley DB are you running with?

What OS?

Ron



Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Deadlock in read-only operations - 06-24-2006 , 08:17 PM



Hi Ron,

I think I have this figured out. The error we're getting is not
actually a deadlock, it was a lock not granted exception. We're using
the standard BDB product, java api. (The one which is based on JNI.)
The lock not granted exception appears to have been our fault.

One thing that threw us off for a bit was that we "assumed" that the
TransactionRunner would handle both deadlock exceptions and lock not
granted exceptions. So we mis-interpreted lock not granted exceptions
as indicating that a good deal of retry had happened, when in fact it
hadn't.

After clearing up some of the code, we now seem to be deadlock free.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.