zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

Blame SOURCES/0053-Ticket-49257-Reject-dbcachesize-updates-while-auto-c.patch

b69e47
From 550d30d3aa27cd69057604e1ee7d5ca43711d718 Mon Sep 17 00:00:00 2001
b69e47
From: Mark Reynolds <mreynolds@redhat.com>
b69e47
Date: Mon, 15 May 2017 13:30:22 -0400
b69e47
Subject: [PATCH] Ticket 49257 - Reject dbcachesize updates while auto cache
b69e47
 sizing is enabled
b69e47
b69e47
Description:  We should reject updates to nsslapd-dbcachesize while auto cache sizing
b69e47
              is in effect.  This is because at startup we would overwrite the
b69e47
              manually set dbcache size anyway.  It would never take effect, so it
b69e47
              should be rejected.
b69e47
b69e47
https://pagure.io/389-ds-base/issue/49257
b69e47
b69e47
Reviewed by: tbordaz & firstyear(Thanks!!)
b69e47
---
b69e47
 ldap/servers/slapd/back-ldbm/ldbm_config.c | 13 ++++++++++++-
b69e47
 1 file changed, 12 insertions(+), 1 deletion(-)
b69e47
b69e47
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
b69e47
index f7edd9e..6c1dda0 100644
b69e47
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
b69e47
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
b69e47
@@ -420,7 +420,7 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
b69e47
         /* Stop the user configuring a stupidly small cache */
b69e47
         /* min: 8KB (page size) * def thrd cnts (threadnumber==20). */
b69e47
 #define DBDEFMINSIZ     500000
b69e47
-        /* We allow a value of 0, because the autotuting in start.c will
b69e47
+        /* We allow a value of 0, because the autotuning in start.c will
b69e47
          * register that, and trigger the recalculation of the dbcachesize as
b69e47
          * needed on the next start up.
b69e47
          */
b69e47
@@ -443,7 +443,18 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
b69e47
                 return LDAP_UNWILLING_TO_PERFORM;
b69e47
             }
b69e47
         }
b69e47
+
b69e47
         if (CONFIG_PHASE_RUNNING == phase) {
b69e47
+            if (val > 0 && li->li_cache_autosize) {
b69e47
+                /* We are auto-tuning the cache, so this change would be overwritten - return an error */
b69e47
+                slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
b69e47
+                    "Error: \"nsslapd-dbcachesize\" can not be updated while \"nsslapd-cache-autosize\" is set "
b69e47
+                    "in \"cn=config,cn=ldbm database,cn=plugins,cn=config\".");
b69e47
+                slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_dbcachesize_set",
b69e47
+                    "\"nsslapd-dbcachesize\" can not be set while \"nsslapd-cache-autosize\" is set "
b69e47
+                    "in \"cn=config,cn=ldbm database,cn=plugins,cn=config\".\n");
b69e47
+                return LDAP_UNWILLING_TO_PERFORM;
b69e47
+            }
b69e47
             li->li_new_dbcachesize = val;
b69e47
             if (val == 0) {
b69e47
                 slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_config_dbcachesize_set", "cache size reset to 0, will be autosized on next startup.\n");
b69e47
-- 
b69e47
2.9.4
b69e47