Comment 28 for bug 15270

Revision history for this message
In , Florian Weimer (fw) wrote : Fixed in upstream CVS

See this message below. Recent OpenLDAP versions will recover
automatically, as needed.

Rumor has it that Berkeley DB 4.4 will offer similar functionality,
too.

From: Howard Chu <email address hidden>
Subject: Re: Force single thread of control during recovery
Newsgroups: comp.databases.berkeley-db
Date: Sun, 15 May 2005 16:42:07 -0700
Message-ID: <email address hidden>

oleksandr kalinin wrote:
> Hello All,
> In my environment, there is a command-line database maintenance tool
> for
> users to display, add, modify records etc. During recovery, I would have to
> make sure this tool does not attempt to open the environment so that there
> is only single thread of control accessing it. Seems like I have to
> implement own locking mechanism to handle this, or is there some "smarter"
> way, e.g. in the library? Locking is easy in this case, but just to make
> sure I haven't missed something important in documentation... Many thanks
> for your help.

The current releases of the BDB library don't offer any support here. We
wrote our own locking mechanism for OpenLDAP to mediate access to the
environment. We record the process IDs of all processes with a valid
handle to the environment, so we can detect unclean exits and force a
recovery only when needed. And of course, only one process can trigger a
recovery. The code is in OpenLDAP's CVS if you're interested,
servers/slapd/back-bdb/alock.c

--
  -- Howard Chu
  Chief Architect, Symas Corp. Director, Highland Sun
  http://www.symas.com http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support