]> git.sur5r.net Git - openldap/commitdiff
More for #5860 - if the cache blew past the maxsize, bring it all the way
authorHoward Chu <hyc@openldap.org>
Wed, 18 Mar 2009 18:18:40 +0000 (18:18 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 18 Mar 2009 18:18:40 +0000 (18:18 +0000)
back down to size.

servers/slapd/back-bdb/cache.c

index 260623cfa82ff4bef803c33abf572885b67e5ff1..66071dccc7c0d180b40862e7584d3898a96a9a6b 100644 (file)
@@ -674,8 +674,12 @@ bdb_cache_lru_purge( struct bdb_info *bdb )
        else
                eimax = bdb->bi_cache.c_eimax;
 
-       if ( bdb->bi_cache.c_cursize > bdb->bi_cache.c_maxsize )
+       efree = bdb->bi_cache.c_cursize - bdb->bi_cache.c_maxsize;
+       if ( efree < 1 )
+               efree = 0;
+       else if (efree < bdb->bi_cache.c_minfree )
                efree = bdb->bi_cache.c_minfree;
+
        if ( bdb->bi_cache.c_leaves > eimax ) {
                eifree = bdb->bi_cache.c_minfree * 10;
                if ( eifree >= eimax )