bsddb3 locking questions

E

Eric S. Johansson

are there any simple examples of how to do record locking with bsddb3?

the bsddb3 documentation is reasonably opaque. For example, the DB
initialization requires a DBEnv instance for certain environmental
features such as locking. but if you want locking, what happens next?
I suspect the pattern goes something like the following but it's not
clear from the documentation.

dbe = DBEnv.open()
(does the home directory need to be specified or is there a systemwide
default? Is this per application or does a common pool work?

dbe.set_lk_detect(...DB_LOCK_YOUNGEST)
(but what about db_deadlock??? do I need a cron job?)

dbe.lock_id()

dbi = db.DB()

dbi.open(..)
(does the filename specified here need to be the same directory as the
homedir in DBEnv or can it in a totally separate location? any
advantages to either?)

lock = dbe.get_lock()
dbi.get/put
dbe.lock_put(lock)

(the above pattern is for record locking but for database locking, the
lock get and put calls would bracket the open/close call)


if you close the database, should you automatically close the env or (as
I suspect) the database environment can cover one or more database
specific incarnations but if you have access different databases, each
one should have its own environment.

anything else I'm missing?

thanks for any guidance,
---eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,274
Messages
2,571,372
Members
48,064
Latest member
alibsskemoSeAve

Latest Threads

Top