Berkeley DB Reference Guide:
Transaction Subsystem

PrevRefNext

Cursor Stability

In the absence of locking, no guarantees are made about the stability of cursors in different processes or threads. However, the Btree, Queue and Recno access methods guarantee that cursor operations, interspersed with other cursor or non-cursor operations in the same thread of control will always return keys in order and will return each non-deleted key/data pair exactly once. Because the Hash access method uses a dynamic hashing algorithm, it cannot guarantee any form of stability in the presence of inserts and deletes unless locking is performed.

If locking was specified when the Berkeley DB file was opened, but transactions are not in effect, the access methods provide repeatable reads with respect to the cursor. That is, a DB_CURRENT call on the cursor is guaranteed to return the same record as was returned on the last call to the cursor.

With the exception of the Queue access method, in the presence of transactions, all access method calls between a call to txn_begin and a call to txn_abort or txn_commit provide degree 3 consistency (serializable transactions).

The Queue access method permits phantom records to appear between calls. That is, deleted records are not locked, therefore another transaction may replace a deleted record between two calls to retrieve it. The record would not appear in the first call but would be seen by the second call.

For all access methods, a cursor scan of the database performed within the context of a transaction is guaranteed to return each key/data pair once and only once, except in the following case. If, while performing a cursor scan using the Hash access method, the transaction performing the scan inserts a new pair into the database, it is possible that duplicate key/data pairs will be returned.

PrevRefNext

Copyright Sleepycat Software