]> git.sur5r.net Git - openldap/commitdiff
do not cache internal search results for present entry priming
authorJong Hyuk Choi <jongchoi@openldap.org>
Thu, 25 Sep 2003 07:49:50 +0000 (07:49 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Thu, 25 Sep 2003 07:49:50 +0000 (07:49 +0000)
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/proto-bdb.h
servers/slapd/back-bdb/search.c

index 02db20c8c5ba58dc31e4b101d6e437e2a7e73ddb..e5875e0c37324bf2f8356537db24305aceac5e87 100644 (file)
@@ -1078,3 +1078,24 @@ bdb_locker_id( Operation *op, DB_ENV *env, int *locker )
        return 0;
 }
 #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 );
+}
index 16519b411dc08ec03b475abf6bbe2b275e19ef6d..9ad2193503537c90c39b6923ce7be3e4b47f7274 100644 (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_modrdn                       BDB_SYMBOL(cache_modrdn)
 #define bdb_cache_release_all          BDB_SYMBOL(cache_release_all)
+#define bdb_cache_delete_entry         BDB_SYMBOL(cache_delete_entry)
 
 int bdb_cache_children(
        Operation *op,
@@ -478,6 +479,12 @@ void bdb_cache_delete_cleanup(
        Entry   *e
 );
 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
 int hdb_cache_load(
index 93a8714d333da7e171823432c364c5240f704177..2d3f245c50652d4e331a4cb01fcb08d3036ce400 100644 (file)
@@ -1218,7 +1218,10 @@ loop_continue:
                        /* free reader lock */
                        if (!IS_PSEARCH) {
                                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;
                        rs->sr_entry = NULL;