]> git.sur5r.net Git - openldap/commitdiff
More for dynamic dbenv swapping
authorHoward Chu <hyc@openldap.org>
Fri, 22 Apr 2005 23:02:01 +0000 (23:02 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 22 Apr 2005 23:02:01 +0000 (23:02 +0000)
servers/slapd/back-bdb/config.c
servers/slapd/back-bdb/init.c

index ba12a9ae00792456ca81d7be2027f9db71249aa3..e1c9e23f27b0972d622118683fc68f2a007f3d75 100644 (file)
@@ -425,6 +425,8 @@ bdb_cf_gen(ConfigArgs *c)
                        ch_free( bdb->bi_db_config_path );
                        bdb->bi_db_config_path = NULL;
                        c->cleanup = bdb_cf_cleanup;
+                       ldap_pvt_thread_pool_purgekey( bdb->bi_dbenv );
+                       ldap_pvt_thread_pool_purgekey( ((char *)bdb->bi_dbenv) + 1 );
                        break;
                case BDB_NOSYNC:
                        bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC, 0 );
index 1b867440ef4b96000d606280ee0b5e1c84c51d54..8821698660dc3804dbfa612898be41b1df5f72cc 100644 (file)
@@ -571,7 +571,7 @@ bdb_db_close( BackendDB *be )
        ber_bvarray_free( bdb->bi_db_config );
        bdb->bi_db_config = NULL;
 
-       while( bdb->bi_ndatabases-- ) {
+       while( bdb->bi_databases && bdb->bi_ndatabases-- ) {
                db = bdb->bi_databases[bdb->bi_ndatabases];
                rc = db->bdi_db->close( db->bdi_db, 0 );
                /* Lower numbered names are not strdup'd */
@@ -582,9 +582,6 @@ bdb_db_close( BackendDB *be )
        free( bdb->bi_databases );
        bdb->bi_databases = NULL;
 
-       bdb_attr_index_destroy( bdb->bi_attrs );
-       bdb->bi_attrs = NULL;
-
        bdb_cache_release_all (&bdb->bi_cache);
 
        if ( bdb->bi_idl_cache_max_size ) {
@@ -650,6 +647,8 @@ bdb_db_destroy( BackendDB *be )
        if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
        if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
 
+       bdb_attr_index_destroy( bdb->bi_attrs );
+
        ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
        ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
        ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );