]> git.sur5r.net Git - openldap/commitdiff
ITS#4223 don't store negative results in IDL cache
authorHoward Chu <hyc@openldap.org>
Mon, 28 Nov 2005 22:53:03 +0000 (22:53 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 28 Nov 2005 22:53:03 +0000 (22:53 +0000)
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/idl.c

index 311fb30f1934b80041f743b288d1b3ee03671695..185c73491bc9b781da8874dceb3a21b03b9f70a9 100644 (file)
@@ -1006,7 +1006,7 @@ synced:
 
        if ( !BDB_IDL_IS_RANGE( cx->tmp ) && cx->tmp[0] > 3 )
                bdb_idl_sort( cx->tmp, cx->buf );
-       if ( cx->bdb->bi_idl_cache_max_size ) {
+       if ( cx->bdb->bi_idl_cache_max_size && !BDB_IDL_IS_ZERO( cx->tmp )) {
                char *ptr = ((char *)&cx->id)-1;
                cx->key.data = ptr;
                cx->key.size = sizeof(ID)+1;
index c29d9228ce1200c8c082c619125a8cf0a8353b31..e034fb2ff8b5e1c4a77b68bb9b93f69e092f063a 100644 (file)
@@ -325,17 +325,17 @@ bdb_idl_cache_put(
        bdb_idl_cache_entry_t idl_tmp;
        bdb_idl_cache_entry_t *ee;
 
+       if ( rc == DB_NOTFOUND || BDB_IDL_IS_ZERO( ids ))
+               return;
+
        DBT2bv( key, &idl_tmp.kstr );
 
        ee = (bdb_idl_cache_entry_t *) ch_malloc(
                sizeof( bdb_idl_cache_entry_t ) );
        ee->db = db;
-       if ( rc == DB_NOTFOUND || BDB_IDL_IS_ZERO( ids )) {
-               ee->idl = NULL;
-       } else {
-               ee->idl = (ID*) ch_malloc( BDB_IDL_SIZEOF ( ids ) );
-               BDB_IDL_CPY( ee->idl, ids );
-       }
+       ee->idl = (ID*) ch_malloc( BDB_IDL_SIZEOF ( ids ) );
+       BDB_IDL_CPY( ee->idl, ids );
+
        ee->idl_lru_prev = NULL;
        ee->idl_lru_next = NULL;
        ber_dupbv( &ee->kstr, &idl_tmp.kstr );