do not cache internal search results for present entry priming

This commit is contained in:
Jong Hyuk Choi 2003-09-25 07:49:50 +00:00
parent d5823fa912
commit eee84463c0
3 changed files with 32 additions and 1 deletions

View File

@ -1078,3 +1078,24 @@ bdb_locker_id( Operation *op, DB_ENV *env, int *locker )
return 0; return 0;
} }
#endif #endif
void
bdb_cache_delete_entry(
struct bdb_info *bdb,
EntryInfo *ei,
u_int32_t locker,
DB_LOCK *lock )
{
ldap_pvt_thread_rdwr_wlock( &bdb->bi_cache.c_rwlock );
if ( bdb_cache_entry_db_lock( bdb->bi_dbenv, locker, ei, 1, 1, &lock ) == 0 ) {
if ( ei->bei_e && !(ei->bei_state & CACHE_ENTRY_NOT_LINKED )) {
LRU_DELETE( &bdb->bi_cache, ei );
ei->bei_e->e_private = NULL;
bdb_entry_return( ei->bei_e );
ei->bei_e = NULL;
--bdb->bi_cache.c_cursize;
}
bdb_cache_entry_db_unlock( bdb->bi_dbenv, &lock );
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_cache.c_rwlock );
}

View File

@ -423,6 +423,7 @@ void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
#define bdb_cache_modify BDB_SYMBOL(cache_modify) #define bdb_cache_modify BDB_SYMBOL(cache_modify)
#define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn) #define bdb_cache_modrdn BDB_SYMBOL(cache_modrdn)
#define bdb_cache_release_all BDB_SYMBOL(cache_release_all) #define bdb_cache_release_all BDB_SYMBOL(cache_release_all)
#define bdb_cache_delete_entry BDB_SYMBOL(cache_delete_entry)
int bdb_cache_children( int bdb_cache_children(
Operation *op, Operation *op,
@ -478,6 +479,12 @@ void bdb_cache_delete_cleanup(
Entry *e Entry *e
); );
void bdb_cache_release_all( Cache *cache ); void bdb_cache_release_all( Cache *cache );
void bdb_cache_delete_entry(
struct bdb_info *bdb,
EntryInfo *ei,
u_int32_t locker,
DB_LOCK *lock
);
#ifdef BDB_HIER #ifdef BDB_HIER
int hdb_cache_load( int hdb_cache_load(

View File

@ -1218,7 +1218,10 @@ loop_continue:
/* free reader lock */ /* free reader lock */
if (!IS_PSEARCH) { if (!IS_PSEARCH) {
bdb_cache_return_entry_r( bdb->bi_dbenv, bdb_cache_return_entry_r( bdb->bi_dbenv,
&bdb->bi_cache, e , &lock); &bdb->bi_cache, e , &lock );
if ( sop->o_nocaching ) {
bdb_cache_delete_entry( bdb, ei, locker, &lock );
}
} }
e = NULL; e = NULL;
rs->sr_entry = NULL; rs->sr_entry = NULL;