Blame SOURCES/0063-Ticket-48190-idm-ipa-389-ds-base-entry-cache-converg.patch

df9752
From 82d69a381183cf5125ba8d4afdfd12c65544e348 Mon Sep 17 00:00:00 2001
df9752
From: Noriko Hosoi <nhosoi@redhat.com>
df9752
Date: Sun, 31 May 2015 17:08:29 -0700
df9752
Subject: [PATCH 63/72] Ticket #48190 - idm/ipa 389-ds-base entry cache
df9752
 converges to 500 KB in dblayer_is_cachesize_sane
df9752
df9752
Description: This issue was introduced by the fix for Ticket 47499
df9752
commit 1e035d1111f6abcb87e760a2b9e41fa9e05a7ebd.
df9752
df9752
The function dblayer_is_cachesize_sane was originally implemented for
df9752
db cache to check if the given db cache size is larger than the available
df9752
memory or not.  The function resets the size to the available memory size
df9752
if it is larger.  Also, considering the extra metadata size needed for the
df9752
db cache, it multiplies by 0.8 every time it starts the server.  It is not
df9752
needed even for the db cache.  The code is old and we don't have to save
df9752
the memory there.  Thus, this patch removes the resetting code.
df9752
df9752
https://fedorahosted.org/389/ticket/48190
df9752
df9752
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
df9752
df9752
(cherry picked from commit bf9ef718cfd48c26eaf11662f522451d866e7681)
df9752
---
df9752
 ldap/servers/slapd/back-ldbm/dblayer.c              | 7 -------
df9752
 ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 6 ++++--
df9752
 2 files changed, 4 insertions(+), 9 deletions(-)
df9752
df9752
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
df9752
index 2524355..d3deff8 100644
df9752
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
df9752
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
df9752
@@ -1116,13 +1116,6 @@ int dblayer_is_cachesize_sane(size_t *cachesize)
df9752
     if (!issane) {
df9752
         *cachesize = (size_t)((pages - procpages) * pagesize);
df9752
     }
df9752
-    /* We now compensate for DB's own compensation for metadata size 
df9752
-     * They increase the actual cache size by 25%, but only for sizes
df9752
-     * less than 500Meg.
df9752
-     */
df9752
-    if (*cachesize < 500*MEGABYTE) {
df9752
-        *cachesize = (size_t)((double)*cachesize * (double)0.8);
df9752
-    }
df9752
     
df9752
     return issane;
df9752
 }
df9752
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
df9752
index 9b93f9a..f75ca97 100644
df9752
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
df9752
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
df9752
@@ -121,11 +121,12 @@ ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, in
df9752
     ldbm_instance *inst = (ldbm_instance *) arg;
df9752
     int retval = LDAP_SUCCESS;
df9752
     size_t val = (size_t) value;
df9752
+    size_t chkval = val;
df9752
 
df9752
     /* Do whatever we can to make sure the data is ok. */
df9752
 
df9752
     if (apply) {
df9752
-        if (!dblayer_is_cachesize_sane(&val)){
df9752
+        if (!dblayer_is_cachesize_sane(&chkval)){
df9752
             PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
df9752
                     "Error: cachememsize value is too large.");
df9752
             LDAPDebug( LDAP_DEBUG_ANY,"Error: cachememsize value is too large.\n",
df9752
@@ -152,11 +153,12 @@ ldbm_instance_config_dncachememsize_set(void *arg, void *value, char *errorbuf,
df9752
     ldbm_instance *inst = (ldbm_instance *) arg;
df9752
     int retval = LDAP_SUCCESS;
df9752
     size_t val = (size_t)value;
df9752
+    size_t chkval = val;
df9752
 
df9752
     /* Do whatever we can to make sure the data is ok. */
df9752
 
df9752
     if (apply) {
df9752
-        if (!dblayer_is_cachesize_sane(&val)){
df9752
+        if (!dblayer_is_cachesize_sane(&chkval)){
df9752
             PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
df9752
                     "Error: dncachememsize value is too large.");
df9752
             LDAPDebug( LDAP_DEBUG_ANY,"Error: dncachememsize value is too large.\n",
df9752
-- 
df9752
1.9.3
df9752