From 70314bd98bd9104ad06738b4fcb9867e2d5812b0 Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Fri, 9 Jul 2004 03:31:52 +0000 Subject: [PATCH] SLAP_IDL_CACHE macro removed --- servers/slapd/back-bdb/back-bdb.h | 7 ------- servers/slapd/back-bdb/config.c | 3 --- servers/slapd/back-bdb/dn2id.c | 12 ------------ servers/slapd/back-bdb/idl.c | 15 --------------- servers/slapd/back-bdb/init.c | 8 -------- servers/slapd/back-bdb/proto-bdb.h | 2 -- 6 files changed, 47 deletions(-) diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index e3846c9b9b..7ba50a9a0f 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -73,10 +73,6 @@ LDAP_BEGIN_DECL /* The minimum we can function with */ #define MINIMUM_SEARCH_STACK_DEPTH 8 -/* for the IDL cache */ -#define SLAP_IDL_CACHE 1 - -#ifdef SLAP_IDL_CACHE typedef struct bdb_idl_cache_entry_s { struct berval kstr; ldap_pvt_thread_rdwr_t idl_entry_rwlock; @@ -85,7 +81,6 @@ typedef struct bdb_idl_cache_entry_s { struct bdb_idl_cache_entry_s* idl_lru_prev; struct bdb_idl_cache_entry_s* idl_lru_next; } bdb_idl_cache_entry_t; -#endif /* BDB backend specific entry info */ typedef struct bdb_entry_info { @@ -180,7 +175,6 @@ struct bdb_info { LDAP_LIST_HEAD(pl, slap_op) bi_psearch_list; ldap_pvt_thread_rdwr_t bi_pslist_rwlock; LDAP_LIST_HEAD(se, slap_session_entry) bi_session_list; -#ifdef SLAP_IDL_CACHE int bi_idl_cache_max_size; int bi_idl_cache_size; Avlnode *bi_idl_tree; @@ -188,7 +182,6 @@ struct bdb_info { bdb_idl_cache_entry_t *bi_idl_lru_tail; ldap_pvt_thread_rdwr_t bi_idl_tree_rwlock; ldap_pvt_thread_mutex_t bi_idl_tree_lrulock; -#endif }; #define bi_id2entry bi_databases[BDB_ID2ENTRY] diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 31164d91c7..4d2dbbbaba 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -172,7 +172,6 @@ bdb_db_config( bdb->bi_search_stack_depth = MINIMUM_SEARCH_STACK_DEPTH; } -#ifdef SLAP_IDL_CACHE /* size of the IDL cache in entries */ } else if ( strcasecmp( argv[0], "idlcachesize" ) == 0 ) { if ( argc < 2 ) { @@ -183,8 +182,6 @@ bdb_db_config( } if ( !( slapMode & SLAP_TOOL_MODE ) ) bdb->bi_idl_cache_max_size = atoi( argv[1] ); -#endif - } else if ( strcasecmp( argv[0], "sessionlog" ) == 0 ) { int se_id = 0, se_size = 0; struct slap_session_entry *sent; diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index 56f1bc6260..6ab0a03780 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -383,7 +383,6 @@ bdb_dn2id_children( ((char *)key.data)[0] = DN_ONE_PREFIX; AC_MEMCPY( &((char *)key.data)[1], e->e_nname.bv_val, key.size - 1 ); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_size ) { rc = bdb_idl_cache_get( bdb, db, &key, NULL ); if ( rc != LDAP_NO_SUCH_OBJECT ) { @@ -391,7 +390,6 @@ bdb_dn2id_children( return rc; } } -#endif /* we actually could do a empty get... */ DBTzero( &data ); data.data = &id; @@ -641,11 +639,9 @@ hdb_dn2id_add( db->put( db, txn, &key, &data, DB_NODUPDATA ); } -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_size ) { bdb_idl_cache_del( bdb, db, &key ); } -#endif data.data = d; data.size = sizeof(diskNode) + rlen + nrlen; data.flags = DB_DBT_USERMEM; @@ -691,11 +687,9 @@ hdb_dn2id_delete( data.dlen = data.size; data.flags = DB_DBT_USERMEM | DB_DBT_PARTIAL; -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_size ) { bdb_idl_cache_del( bdb, db, &key ); } -#endif rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags ); if ( rc ) return rc; @@ -862,14 +856,12 @@ hdb_dn2id_children( key.data = &e->e_id; key.flags = DB_DBT_USERMEM; -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_size ) { rc = bdb_idl_cache_get( bdb, db, &key, NULL ); if ( rc != LDAP_NO_SUCH_OBJECT ) { return rc; } } -#endif DBTzero(&data); data.data = &d; data.ulen = sizeof(d); @@ -937,7 +929,6 @@ hdb_dn2idl_internal( struct dn2id_cookie *cx ) { -#ifdef SLAP_IDL_CACHE if ( cx->bdb->bi_idl_cache_size ) { cx->rc = bdb_idl_cache_get(cx->bdb, cx->db, &cx->key, cx->tmp); if ( cx->rc == DB_NOTFOUND ) { @@ -947,7 +938,6 @@ hdb_dn2idl_internal( goto gotit; } } -#endif BDB_IDL_ZERO( cx->tmp ); if ( !cx->ei ) { @@ -1044,11 +1034,9 @@ hdb_dn2idl_internal( } saveit: -#ifdef SLAP_IDL_CACHE if ( cx->bdb->bi_idl_cache_max_size ) { bdb_idl_cache_put( cx->bdb, cx->db, &cx->key, cx->tmp, cx->rc ); } -#endif ; gotit: if ( !BDB_IDL_IS_ZERO( cx->tmp )) { diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index d6a29083d6..a7980a3f7a 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -27,7 +27,6 @@ #define IDL_CMP(x,y) ( x < y ? -1 : ( x > y ? 1 : 0 ) ) -#ifdef SLAP_IDL_CACHE #define IDL_LRU_DELETE( bdb, e ) do { \ if ( e->idl_lru_prev != NULL ) { \ e->idl_lru_prev->idl_lru_next = e->idl_lru_next; \ @@ -63,7 +62,6 @@ bdb_idl_entry_cmp( const void *v_idl1, const void *v_idl2 ) if ((rc = idl1->kstr.bv_len - idl2->kstr.bv_len )) return rc; return ( memcmp ( idl1->kstr.bv_val, idl2->kstr.bv_val , idl1->kstr.bv_len ) ); } -#endif #if IDL_DEBUG > 0 static void idl_check( ID *ids ) @@ -304,8 +302,6 @@ bdb_show_key( } } -#ifdef SLAP_IDL_CACHE - /* Find a db/key pair in the IDL cache. If ids is non-NULL, * copy the cached IDL into it, otherwise just return the status. */ @@ -444,7 +440,6 @@ bdb_idl_cache_del( } ldap_pvt_thread_rdwr_wunlock( &bdb->bi_idl_tree_rwlock ); } -#endif int bdb_idl_fetch_key( @@ -495,12 +490,10 @@ bdb_idl_fetch_key( assert( ids != NULL ); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_size ) { rc = bdb_idl_cache_get( bdb, db, key, ids ); if ( rc != LDAP_NO_SUCH_OBJECT ) return rc; } -#endif DBTzero( &data ); @@ -576,9 +569,7 @@ bdb_idl_fetch_key( } if( rc == DB_NOTFOUND ) { -#ifndef SLAP_IDL_CACHE return rc; -#endif } else if( rc != 0 ) { #ifdef NEW_LOGGING @@ -619,11 +610,9 @@ bdb_idl_fetch_key( return -1; } -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_max_size ) { bdb_idl_cache_put( bdb, db, key, ids, rc ); } -#endif return rc; } @@ -659,11 +648,9 @@ bdb_idl_insert_key( assert( id != NOID ); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_size ) { bdb_idl_cache_del( bdb, db, key ); } -#endif DBTzero( &data ); data.size = sizeof( ID ); @@ -856,11 +843,9 @@ bdb_idl_delete_key( } assert( id != NOID ); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_max_size ) { bdb_idl_cache_del( bdb, db, key ); } -#endif DBTzero( &data ); data.data = &tmp; diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 9742b9ca24..5337dcd191 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -196,14 +196,12 @@ bdb_db_open( BackendDB *be ) bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall ); bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect ); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_max_size ) { bdb->bi_idl_tree = NULL; ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock ); ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock ); bdb->bi_idl_cache_size = 0; } -#endif #ifdef BDB_SUBDIRS { @@ -459,9 +457,7 @@ bdb_db_close( BackendDB *be ) int rc; struct bdb_info *bdb = (struct bdb_info *) be->be_private; struct bdb_db_info *db; -#ifdef SLAP_IDL_CACHE bdb_idl_cache_entry_t *entry, *next_entry; -#endif while( bdb->bi_ndatabases-- ) { db = bdb->bi_databases[bdb->bi_ndatabases]; @@ -476,7 +472,6 @@ bdb_db_close( BackendDB *be ) bdb_cache_release_all (&bdb->bi_cache); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_max_size ) { ldap_pvt_thread_rdwr_wlock ( &bdb->bi_idl_tree_rwlock ); avl_free( bdb->bi_idl_tree, NULL ); @@ -491,7 +486,6 @@ bdb_db_close( BackendDB *be ) } ldap_pvt_thread_rdwr_wunlock ( &bdb->bi_idl_tree_rwlock ); } -#endif return 0; } @@ -542,12 +536,10 @@ bdb_db_destroy( BackendDB *be ) ldap_pvt_thread_rdwr_destroy ( &bdb->bi_pslist_rwlock ); ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex ); ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex ); -#ifdef SLAP_IDL_CACHE if ( bdb->bi_idl_cache_max_size ) { ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock ); ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock ); } -#endif ch_free( bdb ); be->be_private = NULL; diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 40a9f5a867..ccdb1aa505 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -203,7 +203,6 @@ BI_entry_get_rw bdb_entry_get; /* * idl.c */ -#ifdef SLAP_IDL_CACHE #define bdb_idl_cache_get BDB_SYMBOL(idl_cache_get) #define bdb_idl_cache_put BDB_SYMBOL(idl_cache_put) @@ -228,7 +227,6 @@ bdb_idl_cache_del( struct bdb_info *bdb, DB *db, DBT *key ); -#endif #define bdb_idl_first BDB_SYMBOL(idl_first) #define bdb_idl_next BDB_SYMBOL(idl_next) -- 2.39.5