[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Berkeley DB 4



I forgot to mention; there's a bug in the db environment shutdown code. It
frees its mutexes before it's done referencing them. I submitted a bug
report (#4991) to Sleepycat but they didn't process it before BDB 4.0 was
released, so you still need to patch it. I found this bug in 3.3.11 but the
code is identical in 4.0.14. env/env_open.c needs the following patch,
otherwise your transaction log files will never close cleanly.

RCS file: RCS/env_open.c,v
retrieving revision 1.1
diff -u -r1.1 env_open.c
--- env_open.c  2001/12/17 23:33:01     1.1
+++ env_open.c  2001/12/17 23:34:39
@@ -8,7 +8,7 @@
 #include "db_config.h"

 #ifndef lint
-static const char revid[] = "$Id: env_open.c,v 1.1 2001/12/17 23:33:01 hyc
Exp
$";
+static const char revid[] = "$Id: env_open.c,v 1.2 2001/12/17 23:34:22 hyc
Exp
$";
 #endif /* not lint */

 #ifndef NO_SYSTEM_INCLUDES
@@ -556,19 +556,6 @@
        ret = 0;

        /*
-        * Discard DB list and its mutex.
-        *
-        * !!!
-        * This must be done before we close the mpool region because we
-        * may have allocated the DB handle mutex in the mpool region.
-        */
-       LIST_INIT(&dbenv->dblist);
-       if (dbenv->dblist_mutexp != NULL) {
-               dbmp = dbenv->mp_handle;
-               __db_mutex_free(dbenv, dbmp->reginfo, dbenv->dblist_mutexp);
-       }
-
-       /*
         * Close subsystems, in the reverse order they were opened (txn
         * must be first, it may want to discard locks and flush the log).
         *
@@ -591,6 +578,19 @@
        if (LOGGING_ON(dbenv)) {
                if ((t_ret = __log_dbenv_refresh(dbenv)) != 0 && ret == 0)
                        ret = t_ret;
+       }
+
+       /*
+        * Discard DB list and its mutex.
+        *
+        * !!!
+        * This must be done before we close the mpool region because we
+        * may have allocated the DB handle mutex in the mpool region.
+        */
+       LIST_INIT(&dbenv->dblist);
+       if (dbenv->dblist_mutexp != NULL) {
+               dbmp = dbenv->mp_handle;
+               __db_mutex_free(dbenv, dbmp->reginfo, dbenv->dblist_mutexp);
        }

        if (MPOOL_ON(dbenv)) {

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

> -----Original Message-----
> From: owner-openldap-devel@OpenLDAP.org
> [mailto:owner-openldap-devel@OpenLDAP.org]On Behalf Of Michael Helm
> Sent: Friday, December 14, 2001 7:45 AM
> To: openldap-devel@OpenLDAP.org
> Subject: Berkeley DB 4
>
>
>
> Berkeley DB is up to rev 4.0.14.  ifdef's in ldbm.c make it
> unusable, perhaps unintentionally.  Any known reason why
> db >= 4 shouldn't work in openldap?
>