Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications
PrevRefNext

Release 4.2: DB_LOCK_NOTGRANTED

In previous releases, configuring lock or transaction timeout values or calling the DB_ENV->txn_begin method with the DB_TXN_NOWAIT flag caused database operation methods to return DB_LOCK_NOTGRANTED, or throw a DbLockNotGrantedException exception. This required applications to unnecessarily handle multiple errors or exception types.

In the Berkeley DB 4.2 release, with one exception, database operations will no longer return DB_LOCK_NOTGRANTED or throw a DbLockNotGrantedException exception. Instead, database operations will return DB_LOCK_DEADLOCK or throw a DbDeadlockException exception. This change should require no application changes, as applications must already be dealing with the possible DB_LOCK_DEADLOCK error return or DbDeadlockException exception from database operations.

The one exception to this rule is the DB->get method using the DB_CONSUME_WAIT flag to consume records from a Queue. If lock or transaction timeouts are set, this method and flag combination may return DB_LOCK_NOTGRANTED or throw a DbLockNotGrantedException exception.

Applications wanting to distinguish between true deadlocks and timeouts can configure database operation methods to return DB_LOCK_NOTGRANTED or throw a DbLockNotGrantedException exception using the DB_TIME_NOTGRANTED flag.

The DB_ENV->lock_get and DB_ENV->lock_vec methods will continue to return DB_LOCK_NOTGRANTED, or throw a DbLockNotGrantedException exception as they have previously done.


PrevRefNext

Copyright (c) 1996,2008 Oracle. All rights reserved.