Hi,
I have an application which uses a Berkeley DB in concurrent data store
mode via the Perl bindings. There are multiple processes accessing the
database, but they write only infrequently so I can live with the
limitation of only having 1 writer at a time.
Each process calls set_isalive and failchk after opening the environment
and recovers with a private environment if DB_RUNRECOVER is returned
before going on to open the database.
However, I occasionally get a hang when a new process tries to
open/join the environment, especially if a previous process has quit
unexpectedly. Working around this seems a bit chicken and egg, as I
need to open the environment before I can failchk it.
Once this hang has occurred, all the db utilities also hang accessing
the environment, so it appears there is some sort of deadlock.
I don't want to recover every time a process starts as it will hose any
other running processes.
I have come up with a solution which I would like your thoughts on:
First open an environment with DB_NOLOCKING and failchk/recover as
required. This gets round the hang (which is presumably mutex related).
Finally open an environment to use for the application without
DB_NOLOCKING.
I notice the docs say DB_NOLOCKING is for debugging only. Does anyone
have thoughts on is use in this scenario? Or is there another way around
this issue that I have not thought of?
Many thanks,
Mark


|