[pybsddb] concurrent access dictionaries

Greg Burd GREG.BURD at oracle.com
Sun Oct 4 14:03:21 CEST 2009


Hello,

 

I'm the product manager for Berkeley DB at Oracle.   CDS does allow multiple readers and a single writer, it uses database level locking.  It doesn't provide protection from failure or transactions and recovery.  In other words, if your application crashes you can't expect the data in the database to be consistent.  For that you'll need to use TDS (transactional data store).  It provides page level locking and ACID transactions.  It ensures consistency of the data even if you crash during database operations.

 

You might take a minute (okay an hour) to watch these two tutorial videos in order (first DS, then CDS, we're working on TDS and HA videos now).

 

http://www.oracle.com/technology/products/berkeley-db/tutorial-berkeleydb-ds.html

http://www.oracle.com/technology/products/berkeley-db/tutorial-berkeleydb-cds.html

 

I hope that helps.

 

-greg

 

 

From: Jeff Johnson [mailto:jbj at jbj.org] 
Sent: Saturday, October 03, 2009 4:53 PM
To: Python bindings for Oracle Berkeley DB
Subject: Re: [pybsddb] concurrent access dictionaries

 

 

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/20091004/c232e106/attachment.htm>


More information about the pybsddb mailing list