]> git.sur5r.net Git - openldap/commitdiff
ITS#3824 remove env after slapadd/slapindex -q
authorHoward Chu <hyc@openldap.org>
Mon, 11 Jul 2005 10:27:59 +0000 (10:27 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 11 Jul 2005 10:27:59 +0000 (10:27 +0000)
servers/slapd/back-bdb/init.c

index a2810c1eca4fa48002dd204ad2312195e75c36a2..802319bbe0c6c8c065fa43b7f120656b98b7236f 100644 (file)
@@ -605,6 +605,32 @@ bdb_db_close( BackendDB *be )
                                db_strerror(rc), rc, 0 );
                        return rc;
                }
+
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 2
+               /* Delete the environment if we were in quick mode. This
+                * works around a bug in bdb4.2 that interferes with the
+                * operation of db_stat and other tools after a slapadd -q
+                * or slapindex -q has taken place.
+                */
+               if( slapMode & SLAP_TOOL_QUICK ) {
+                       rc = db_env_create( &bdb->bi_dbenv, 0 );
+                       if( rc != 0 ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                       "bdb_db_close: db_env_create failed: %s (%d)\n",
+                                       db_strerror(rc), rc, 0 );
+                               return rc;
+                       }
+                       rc = bdb->bi_dbenv->remove(bdb->bi_dbenv, bdb->bi_dbenv_home,
+                                       DB_FORCE);
+                       bdb->bi_dbenv = NULL;
+                       if( rc != 0 ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                       "bdb_db_close: dbenv_remove failed: %s (%d)\n",
+                                       db_strerror(rc), rc, 0 );
+                               return rc;
+                       }
+               }
+#endif
        }
 
        rc = alock_close( &bdb->bi_alock_info );