From: Howard Chu Date: Fri, 22 Apr 2005 23:02:01 +0000 (+0000) Subject: More for dynamic dbenv swapping X-Git-Tag: OPENLDAP_AC_BP~817 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2d277bef3be9f5e0e572f6e91ac6254b465e309e;p=openldap More for dynamic dbenv swapping --- diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index ba12a9ae00..e1c9e23f27 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -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 ); diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 1b867440ef..8821698660 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -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 );