]> git.sur5r.net Git - openldap/commitdiff
Free main-thread keys in db_close, can't do it later because the env
authorHoward Chu <hyc@openldap.org>
Thu, 25 Jan 2007 12:00:40 +0000 (12:00 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 25 Jan 2007 12:00:40 +0000 (12:00 +0000)
will be gone.

servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/init.c

index bfe95749d42677a4da88fe4ec02ccb1d2dd460be..7f93b3bad1096373bf04c069f3da0cf9fd66a3a5 100644 (file)
@@ -1371,6 +1371,19 @@ bdb_locker_id_free( void *key, void *data )
        }
 }
 
+/* free up any keys used by the main thread */
+void
+bdb_locker_flush( DB_ENV *env )
+{
+       void *data;
+       void *ctx = ldap_pvt_thread_pool_context();
+
+       if ( !ldap_pvt_thread_pool_getkey( ctx, env, &data, NULL ) ) {
+               ldap_pvt_thread_pool_setkey( ctx, env, NULL, NULL );
+               bdb_locker_id_free( env, data );
+       }
+}
+
 int
 bdb_locker_id( Operation *op, DB_ENV *env, u_int32_t *locker )
 {
index f89f2db850b92b22e5e2b5d0269773aca30104c0..ce41a5cf6bc0790b286f86c0b75df82509d373b0 100644 (file)
@@ -494,7 +494,9 @@ bdb_db_close( BackendDB *be )
                        XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
                        bdb->bi_cache.c_locker = 0;
                }
-
+#ifdef BDB_REUSE_LOCKERS
+               bdb_locker_flush( bdb->bi_dbenv );
+#endif
                /* force a checkpoint, but not if we were ReadOnly,
                 * and not in Quick mode since there are no transactions there.
                 */