From ebbb6ab21679eb9611d991290c36a9d4a8f2158d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 6 Dec 2007 06:20:42 +0000 Subject: [PATCH] Cleanup prev commits --- servers/slapd/back-bdb/back-bdb.h | 18 ++++++++++++++---- servers/slapd/back-bdb/cache.c | 7 +------ servers/slapd/back-bdb/delete.c | 8 -------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index c83ddf0764..52f939add4 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -153,10 +153,10 @@ typedef struct bdb_cache { EntryInfo *c_lruhead; /* lru - add accessed entries here */ EntryInfo *c_lrutail; /* lru - rem lru entries from here */ EntryInfo c_dntree; - int c_maxsize; + unsigned c_maxsize; int c_cursize; - int c_minfree; - int c_eimax; + unsigned c_minfree; + unsigned c_eimax; int c_eiused; /* EntryInfo's in use */ int c_leaves; /* EntryInfo leaf nodes */ int c_purging; @@ -225,7 +225,7 @@ struct bdb_info { ID bi_lastid; ldap_pvt_thread_mutex_t bi_lastid_mutex; - int bi_idl_cache_max_size; + unsigned bi_idl_cache_max_size; int bi_idl_cache_size; Avlnode *bi_idl_tree; bdb_idl_cache_entry_t *bi_idl_lru_head; @@ -314,6 +314,10 @@ struct bdb_op_info { #define TXN_ID(txn) (txn)->locker #endif +/* #undef BDB_LOG_DEBUG */ + +#ifdef BDB_LOG_DEBUG + /* env->log_printf appeared in 4.4 */ #if DB_VERSION_FULL >= 0x04040000 #define LOG_PRINTF(env,txn,fmt,...) (env)->log_printf((env),(txn),(fmt),__VA_ARGS__) @@ -323,6 +327,12 @@ extern int __db_logmsg(const DB_ENV *env, DB_TXN *txn, const char *op, u_int32_t #define LOG_PRINTF(env,txn,fmt,...) __db_logmsg((env),(txn),"DIAGNOSTIC",0,(fmt),__VA_ARGS__) #endif +#else /* !BDB_LOG_DEBUG */ + +#define LOG_PRINTF(a,b,c,...) + +#endif /* BDB_LOG_DEBUG */ + #endif #ifndef DB_BUFFER_SMALL diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index ffe8580cfc..e6b7f46953 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -358,12 +358,11 @@ bdb_entryinfo_add_internal( bdb->bi_cache.c_leaves++; rc = avl_insert( &ei->bei_parent->bei_kids, ei2, bdb_rdn_cmp, avl_dup_error ); -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) if ( rc ) { + /* This should never happen; entry cache is corrupt */ bdb->bi_dbenv->log_flush( bdb->bi_dbenv, NULL ); assert( !rc ); } -#endif #ifdef BDB_HIER ei->bei_parent->bei_ckids++; #endif @@ -432,10 +431,8 @@ bdb_cache_find_ndn( (ei.bei_nrdn.bv_val - ndn->bv_val); bdb_cache_entryinfo_unlock( eip ); -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Reading %s", ei.bei_nrdn.bv_val ); -#endif lock.mode = DB_LOCK_NG; rc = bdb_dn2id( op, &ei.bei_nrdn, &ei, locker, &lock ); @@ -446,10 +443,8 @@ bdb_cache_find_ndn( return rc; } -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Read got %s(%d)", ei.bei_nrdn.bv_val, ei.bei_id ); -#endif /* DN exists but needs to be added to cache */ ei.bei_nrdn.bv_len = len; diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index b419c1cb07..3ec651b110 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -372,10 +372,8 @@ retry: /* transaction retry */ goto return_results; } -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) LOG_PRINTF( bdb->bi_dbenv, lt2, "slapd Starting delete %s(%d)", e->e_nname.bv_val, e->e_id ); -#endif /* Can't do it if we have kids */ rs->sr_err = bdb_cache_children( op, lt2, e ); @@ -497,10 +495,8 @@ retry: /* transaction retry */ p = NULL; } -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) LOG_PRINTF( bdb->bi_dbenv, lt2, "slapd Commit1 delete %s(%d)", e->e_nname.bv_val, e->e_id ); -#endif if ( TXN_COMMIT( lt2, 0 ) != 0 ) { rs->sr_err = LDAP_OTHER; @@ -528,10 +524,8 @@ retry: /* transaction retry */ } } else { -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) LOG_PRINTF( bdb->bi_dbenv, ltid, "slapd Cache delete %s(%d)", e->e_nname.bv_val, e->e_id ); -#endif rc = bdb_cache_delete( bdb, e, locker, &lock ); switch( rc ) { @@ -545,10 +539,8 @@ retry: /* transaction retry */ ltid = NULL; op->o_private = NULL; -#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Committed delete %s(%d)", e->e_nname.bv_val, e->e_id ); -#endif if( rs->sr_err != 0 ) { Debug( LDAP_DEBUG_TRACE, -- 2.39.5