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