ldap/servers/slapd/back-ldbm/ldbm_config.c | 29 +++++------------------------
ldap/servers/slapd/back-ldbm/start.c | 6 ++++--
ldap/servers/slapd/util.c | 9 ++++++---
3 files changed, 15 insertions(+), 29 deletions(-)
New commits:
commit 1b8baa83d9fdbecec5b6ce7182524eb7198cc578
Author: William Brown <firstyear(a)redhat.com>
Date: Thu Jun 9 12:56:36 2016 +1000
Ticket 48873 - Backend should accept the reduced cache allocation when issane == 1
Bug Description: We introduced a stricter cache checking mode, and corrected
our cache check behaviours. Sadly, at some sites, this will cause pain as
the admins may not be ready for this.
Fix Description: Make the error messages clearer. We also DO NOT prevent
server start up on an invalid config, but we do WARN that this behaviour
will change.
https://fedorahosted.org/389/ticket/48873
Author: wibrown
Review by: tbordaz (Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c
b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 37ce02d..11cc373 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -425,8 +425,8 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char
*errorbuf, i
} else if (val > li->li_dbcachesize) {
delta = val - li->li_dbcachesize;
if (!util_is_cachesize_sane(&delta)){
- slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error:
dbcachememsize value is too large.");
- LDAPDebug0Args(LDAP_DEBUG_ANY,"Error: dbcachememsize value is too
large.\n");
+ slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error:
nsslapd-dbcachesize value is too large.");
+ LDAPDebug0Args(LDAP_DEBUG_ANY,"Error: nsslapd-dbcachesize value is
too large.\n");
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -481,36 +481,17 @@ static int ldbm_config_dbncache_set(void *arg, void *value, char
*errorbuf, int
struct ldbminfo *li = (struct ldbminfo *) arg;
int retval = LDAP_SUCCESS;
size_t val = (size_t) ((uintptr_t)value);
- size_t delta = 0;
- /* There is an error here. We check the new val against our current mem-alloc
- * Issue is that we already are using system pages, so while our value *might*
- * be valid, we may reject it here due to the current procs page usage.
- *
- * So how do we solve this? If we are setting a SMALLER value than we
- * currently have ALLOW it, because we already passed the cache sanity.
- * If we are setting a LARGER value, we check the delta of the two, and make
- * sure that it is sane.
- */
-
if (apply) {
- if (val > li->li_dbncache) {
- delta = val - li->li_dbncache;
- if (!util_is_cachesize_sane(&delta)){
- slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error:
dbncache size value is too large.");
- LDAPDebug1Arg(LDAP_DEBUG_ANY,"Error: dbncache size value is too
large.\n", val);
- return LDAP_UNWILLING_TO_PERFORM;
- }
- }
-
+
if (CONFIG_PHASE_RUNNING == phase) {
li->li_new_dbncache = val;
- LDAPDebug(LDAP_DEBUG_ANY, "New db ncache will not take affect until the
server is restarted\n", 0, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "New nsslapd-dbncache will not take affect
until the server is restarted\n", 0, 0, 0);
} else {
li->li_new_dbncache = val;
li->li_dbncache = val;
}
-
+
}
return retval;
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index acac2aa..299e5f0 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -266,7 +266,8 @@ ldbm_back_start( Slapi_PBlock *pb )
issane = util_is_cachesize_sane(&total_size);
if (!issane) {
/* Right, it's time to panic */
- LDAPDebug( LDAP_DEBUG_ANY, "CRITICAL: It is highly likely your memory
configuration will EXCEED your systems memory.\n", 0, 0, 0 );
+ LDAPDebug( LDAP_DEBUG_ANY, "CRITICAL: It is highly likely your memory
configuration of all backends will EXCEED your systems memory.\n", 0, 0, 0 );
+ LDAPDebug( LDAP_DEBUG_ANY, "CRITICAL: In a future release this WILL prevent
server start up. You MUST alter your configuration.\n", 0, 0, 0 );
LDAPDebug(LDAP_DEBUG_ANY,
"Total entry cache size: %llu B; "
"dbcache size: %llu B; "
@@ -278,7 +279,8 @@ ldbm_back_start( Slapi_PBlock *pb )
#endif
);
LDAPDebug(LDAP_DEBUG_ANY, msg, 0,0,0);
- return SLAPI_FAIL_GENERAL;
+ /* WB 2016 - This should be UNCOMMENTED in a future release */
+ /* return SLAPI_FAIL_GENERAL; */
}
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 3f17461..e96b32b 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1787,8 +1787,11 @@ int util_is_cachesize_sane(size_t *cachesize)
* the remaining system mem to the cachesize instead, and log a warning
*/
*cachesize = (size_t)((availpages * 0.75 ) * pagesize);
- slapi_log_error(SLAPI_LOG_FATAL, "util_is_cachesize_sane",
"Available pages %lu, requested pages %lu, pagesize %lu\n", (unsigned
long)availpages, (unsigned long)cachepages, (unsigned long)pagesize);
- slapi_log_error(SLAPI_LOG_FATAL, "util_is_cachesize_sane",
"WARNING adjusted cachesize to %lu\n", (unsigned long)*cachesize);
+ /* These are now trace warnings, because it was to confusing to log this *then*
kill the request anyway.
+ * Instead, we will let the caller worry about the notification, and we'll
just use this in debugging and tracing.
+ */
+ slapi_log_error(SLAPI_LOG_TRACE, "util_is_cachesize_sane",
"Available pages %lu, requested pages %lu, pagesize %lu\n", (unsigned
long)availpages, (unsigned long)cachepages, (unsigned long)pagesize);
+ slapi_log_error(SLAPI_LOG_TRACE, "util_is_cachesize_sane",
"WARNING adjusted cachesize to %lu\n", (unsigned long)*cachesize);
}
#else
size_t freepages = 0;
@@ -1808,7 +1811,7 @@ int util_is_cachesize_sane(size_t *cachesize)
#endif
out:
if (!issane) {
- slapi_log_error(SLAPI_LOG_FATAL,"util_is_cachesize_sane",
"WARNING: Cachesize not sane \n");
+ slapi_log_error(SLAPI_LOG_TRACE,"util_is_cachesize_sane",
"WARNING: Cachesize not sane \n");
}
return issane;