瀏覽代碼

Ticket #48190 - idm/ipa 389-ds-base entry cache converges to 500 KB in dblayer_is_cachesize_sane

Description: This issue was introduced by the fix for Ticket 47499
commit 1e035d1111f6abcb87e760a2b9e41fa9e05a7ebd.

The function dblayer_is_cachesize_sane was originally implemented for
db cache to check if the given db cache size is larger than the available
memory or not.  The function resets the size to the available memory size
if it is larger.  Also, considering the extra metadata size needed for the
db cache, it multiplies by 0.8 every time it starts the server.  It is not
needed even for the db cache.  The code is old and we don't have to save
the memory there.  Thus, this patch removes the resetting code.

https://fedorahosted.org/389/ticket/48190

Reviewed by [email protected] (Thank you, Mark!!)
Noriko Hosoi 10 年之前
父節點
當前提交
bf9ef718cf
共有 2 個文件被更改,包括 4 次插入9 次删除
  1. 0 7
      ldap/servers/slapd/back-ldbm/dblayer.c
  2. 4 2
      ldap/servers/slapd/back-ldbm/ldbm_instance_config.c

+ 0 - 7
ldap/servers/slapd/back-ldbm/dblayer.c

@@ -1116,13 +1116,6 @@ int dblayer_is_cachesize_sane(size_t *cachesize)
     if (!issane) {
         *cachesize = (size_t)((pages - procpages) * pagesize);
     }
-    /* We now compensate for DB's own compensation for metadata size 
-     * They increase the actual cache size by 25%, but only for sizes
-     * less than 500Meg.
-     */
-    if (*cachesize < 500*MEGABYTE) {
-        *cachesize = (size_t)((double)*cachesize * (double)0.8);
-    }
     
     return issane;
 }

+ 4 - 2
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c

@@ -121,11 +121,12 @@ ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, in
     ldbm_instance *inst = (ldbm_instance *) arg;
     int retval = LDAP_SUCCESS;
     size_t val = (size_t) value;
+    size_t chkval = val;
 
     /* Do whatever we can to make sure the data is ok. */
 
     if (apply) {
-        if (!dblayer_is_cachesize_sane(&val)){
+        if (!dblayer_is_cachesize_sane(&chkval)){
             PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
                     "Error: cachememsize value is too large.");
             LDAPDebug( LDAP_DEBUG_ANY,"Error: cachememsize value is too large.\n",
@@ -152,11 +153,12 @@ ldbm_instance_config_dncachememsize_set(void *arg, void *value, char *errorbuf,
     ldbm_instance *inst = (ldbm_instance *) arg;
     int retval = LDAP_SUCCESS;
     size_t val = (size_t)value;
+    size_t chkval = val;
 
     /* Do whatever we can to make sure the data is ok. */
 
     if (apply) {
-        if (!dblayer_is_cachesize_sane(&val)){
+        if (!dblayer_is_cachesize_sane(&chkval)){
             PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
                     "Error: dncachememsize value is too large.");
             LDAPDebug( LDAP_DEBUG_ANY,"Error: dncachememsize value is too large.\n",