Tuesday, May 16, 2017

[389-commits] [389-ds-base] 01/01: Ticket 49257 - Reject dbcachesize updates while auto cache sizing is enabled

This is an automated email from the git hooks/post-receive script.

mreynolds pushed a commit to branch master
in repository 389-ds-base.

commit 9327a99313f6cbd291196f079ac4f7dfa40ad18a
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Mon May 15 13:30:22 2017 -0400

Ticket 49257 - Reject dbcachesize updates while auto cache sizing is enabled

Description: We should reject updates to nsslapd-dbcachesize while auto cache sizing
is in effect. This is because at startup we would overwrite the
manually set dbcache size anyway. It would never take effect, so it
should be rejected.

https://pagure.io/389-ds-base/issue/49257

Reviewed by: tbordaz & firstyear(Thanks!!)

(cherry picked from commit 910a4ce2b5a19fa8de939519ac865a56feb7b626)
---
ldap/servers/slapd/back-ldbm/ldbm_config.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 008e8aa..33012e8 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -420,7 +420,7 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
/* Stop the user configuring a stupidly small cache */
/* min: 8KB (page size) * def thrd cnts (threadnumber==20). */
#define DBDEFMINSIZ 500000
- /* We allow a value of 0, because the autotuting in start.c will
+ /* We allow a value of 0, because the autotuning in start.c will
* register that, and trigger the recalculation of the dbcachesize as
* needed on the next start up.
*/
@@ -443,7 +443,18 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
return LDAP_UNWILLING_TO_PERFORM;
}
}
+
if (CONFIG_PHASE_RUNNING == phase) {
+ if (val > 0 && li->li_cache_autosize) {
+ /* We are auto-tuning the cache, so this change would be overwritten - return an error */
+ slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "Error: \"nsslapd-dbcachesize\" can not be updated while \"nsslapd-cache-autosize\" is set "
+ "in \"cn=config,cn=ldbm database,cn=plugins,cn=config\".");
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_dbcachesize_set",
+ "\"nsslapd-dbcachesize\" can not be set while \"nsslapd-cache-autosize\" is set "
+ "in \"cn=config,cn=ldbm database,cn=plugins,cn=config\".\n");
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
li->li_new_dbcachesize = val;
if (val == 0) {
slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_config_dbcachesize_set", "cache size reset to 0, will be autosized on next startup.\n");

--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org

No comments:

Post a Comment