[pybsddb] concurrent access dictionaries

Jeff Johnson jbj at jbj.org
Sat Oct 3 22:52:47 CEST 2009


On Oct 3, 2009, at 3:21 PM, Benjamin Rutt wrote:

> The docs say (for the version shipped with python 2.6), in http://www.jcea.es/programacion/pybsddb_doc/4.7.3/introduction.html#introduction:
>
> "3.  Concurrent access dictionaries: This refers to the ability to  
> simultaneously have one writer and multiple readers of a DB (either  
> in multiple threads or processes) and is implemented simply by  
> creating a DBEnv with certain flags. No extra work is required to  
> allow this access mode in bsddb3."
>
> Could someone elaborate on exactly which "certain flags" are needed  
> when creating the DBEnv to achieve the goal here in #3?  Did I get  
> it right below (for the b-tree access method)?
>

Sure.

This is the "INIT_CDB" model, been used by RPM for years.

Disclaimer: I don't use pybsddb nor python, but I do use Berkeley DB
with INIT_CDB daily for years.
> from bsddb import db
>
> env = db.DBEnv()
> env.open('/some/dir', db.DB_CREATE | db.DB_THREAD | db.DB_INIT_CDB |  
> db.DB_INIT_MPOOL)
> dbh = db.DB(env)
> dbh.open("foo.db", None, db.DB_BTREE, db.DB_CREATE)
>
>

These flags look right to me. Try w/o DB_THREAD if you need a sanity  
check,
that's exactly what RPM uses. DB_THREAD is needed iff you have threads
sharing the same locks as processes.

73 de Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20091003/1a98e5d9/attachment.htm>


More information about the pybsddb mailing list