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 f39cc62585d3b636bc286fc90951668a4a492048
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue May 16 13:19:43 2017 -0400
Ticket 49257 - Reject nsslapd-cachememsize & nsslapd-cachesize when
nsslapd-cache-autosize is set
Description: We need to also reject entry cache changes when cache autosizing is
being used.
I also found out that we were not registering the ldbm instance
callbacks at startup.
So all those functions were only used when creating an instance, and not
after it was
started.
https://pagure.io/389-ds-base/issue/49257
Reviewed by: tbordaz(Thanks!)
(cherry picked from commit 35c0834831d5b84ecf723769cea3a806e60525bc)
---
ldap/servers/slapd/back-ldbm/instance.c | 19 +++++++++-----
.../servers/slapd/back-ldbm/ldbm_instance_config.c | 30 +++++++++++++++++++---
ldap/servers/slapd/back-ldbm/start.c | 2 +-
3 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/ldap/servers/slapd/back-ldbm/instance.c
b/ldap/servers/slapd/back-ldbm/instance.c
index f79d048..8b38644 100644
--- a/ldap/servers/slapd/back-ldbm/instance.c
+++ b/ldap/servers/slapd/back-ldbm/instance.c
@@ -302,12 +302,19 @@ ldbm_instance_startall(struct ldbminfo *li)
inst = (ldbm_instance *) object_get_data(inst_obj);
ldbm_instance_set_flags(inst);
rc1 = ldbm_instance_start(inst->inst_be);
- if (rc1 != 0) {
- rc = rc1;
- } else {
- vlv_init(inst);
- slapi_mtn_be_started(inst->inst_be);
- }
+ if (rc1 != 0) {
+ rc = rc1;
+ } else {
+ if(ldbm_instance_config_load_dse_info(inst) != 0){
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_instance_startall",
+ "Loading database instance configuration failed for
(%s)\n",
+ inst->inst_name);
+ rc = -1;
+ } else {
+ vlv_init(inst);
+ slapi_mtn_be_started(inst->inst_be);
+ }
+ }
inst_obj = objset_next_obj(li->li_instance_set, inst_obj);
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 4ea7fa6..955a8ea 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -66,7 +66,7 @@ static int
ldbm_instance_config_cachesize_set(void *arg,
void *value,
char *errorbuf __attribute__((unused)),
- int phase __attribute__((unused)),
+ int phase,
int apply)
{
ldbm_instance *inst = (ldbm_instance *) arg;
@@ -76,6 +76,18 @@ ldbm_instance_config_cachesize_set(void *arg,
/* Do whatever we can to make sure the data is ok. */
if (apply) {
+ if (CONFIG_PHASE_RUNNING == phase) {
+ if (val > 0 && inst->inst_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-cachesize\" 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_instance_config_cachesize_set",
+ "\"nsslapd-cachesize\" 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;
+ }
+ }
cache_set_max_entries(&(inst->inst_cache), val);
}
@@ -94,7 +106,7 @@ static int
ldbm_instance_config_cachememsize_set(void *arg,
void *value,
char *errorbuf,
- int phase __attribute__((unused)),
+ int phase,
int apply)
{
ldbm_instance *inst = (ldbm_instance *) arg;
@@ -115,6 +127,18 @@ ldbm_instance_config_cachememsize_set(void *arg,
*/
if (apply) {
+ if (CONFIG_PHASE_RUNNING == phase) {
+ if (val > 0 && inst->inst_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-cachememsize\" 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_instance_config_cachememsize_set",
+ "\"nsslapd-cachememsize\" 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;
+ }
+ }
if (val > inst->inst_cache.c_maxsize) {
delta = val - inst->inst_cache.c_maxsize;
delta_original = delta;
@@ -863,7 +887,7 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb,
continue;
}
- /* This assumes there is only one bval for this mod. */
+ /* This assumes there is only one bval for this mod. */
if (mods[i]->mod_bvalues == NULL) {
/* This avoids the null pointer deref.
* In ldbm_config.c ldbm_config_set, it checks for the NULL.
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index 1834a19..d4e8bb8 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -169,7 +169,7 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
}
slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk
physical memory\n", mi->system_total_bytes / 1024);
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk
avaliable\n", mi->system_available_bytes / 1024);
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk
available\n", mi->system_available_bytes / 1024);
/* We've now calculated the autotuning values. Do we need to apply it?
* we use the logic of "if size is 0, or autosize is > 0. This way three
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.