[Date Prev][Date Next] [Chronological] [Thread] [Top]


>>It seems to me that if HAVE_BERKELEY_DB_THREAD is defined, multiple
>>OpenLdap threads can access Berkeley DB databases concurrently, and,
>>there is no provision to restrict this access to read-only threads.
>>This concerns me; usually, if multiple threads of control are in the
>>database code, and, one of those threads is updating the database,
>>there can be deadlocks which require transactional support to resolve.
> The backend implements a higher level locking system which orders
> access in a manner which should avoid deadlock.

It's important to remember that Berkeley DB does page-level
locking, and, in order to avoid deadlock you would have to
order access to pages, not records on pages.  That's almost
impossible to do unless you have a specialized data set with
fixed-sized pages and records.

>>Can someone please tell me:
>>+ If HAVE_BERKELEY_DB_THREAD is defined, can multiple OpenLdap threads
>>  of control access the Berkeley DB API concurrently?
> Yes.
>>+ If so, can one of those multiple threads be modifying the database?
> Yes.
>>  Can two of those multiple threads be modifying the database?
> Yes.

Since OpenLdap doesn't support transactions yet, my guess is
that it shouldn't be permitting multiple threads of control to
access the database, as long as there's at least one writer
thread.  Under high levels of concurrency, when deadlock can
occur, the database may become corrupted.

To enhance performance while still implementing this restriction
in OpenLdap, OpenLdap could use Berkeley DB's Concurrent Data
Store code base.  The Berkeley DB Concurrent Data Store product
adds multiple-reader, single writer capabilities to the Berkeley
DB Data Store product, supporting applications that need
concurrent updates and do not want to implement their own
locking protocols.  (Berkeley DB Concurrent Data Store is
intended for applications that require occasional write access
to a database that is largely used for reading.)


Keith Bostic
Sleepycat Software Inc.		bostic@sleepycat.com
118 Tower Rd.			+1-781-259-3139
Lincoln, MA 01773		http://www.sleepycat.com