Forum Stats

  • 3,769,977 Users
  • 2,253,041 Discussions
  • 7,875,257 Comments

Discussions

Blocked getSearchKey cursor skips duplicate records when unblocked

Implementation-Title: Berkeley DB Java Edition

Implementation-Version: 7.5.12

Implementation-Vendor: Oracle

Implementation-URL: http://www.oracle.com/

Build-Date: 2017-12-18 11:39:44 UTC

In a transactional, non-replicated database that allows duplicates, I see the following behavior:

There is a single record with key="Duplicated" and value="2" in the database.

The cursor in transaction A locks the record with getSearchKey() with key="Duplicated" and LockMode.RMW.

A different cursor in transaction B does the same search and must wait on the lock.

1. If I put a record with key="Duplicated" and value="1" with transaction A and commit, the transaction B search will acquire the lock and see the data of the record with value="2". After that, calls to getNextDup() will not find the record with value="1".

2. If I put a record with key="Duplicated" and value="1" and delete the record with key="Duplicated" and value="2" with transaction A and commit, the transaction B search will return OperationStatus.NOTFOUND.

Question:

Is there a way for transaction A to acquire a lock for all of key="Duplicated" and LockMode.RMW such that transaction B will efficiently see all of the data for key="Duplicated"?

This discussion has been closed.