|
|
dc8c34 |
From 2195ce2313fcf78a2ebff6525e399d1267665c2b Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
dc8c34 |
Date: Fri, 9 Jan 2015 16:50:12 -0800
|
|
|
dc8c34 |
Subject: [PATCH 300/305] Ticket #47934 - nsslapd-db-locks modify not taking
|
|
|
dc8c34 |
into account.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Description: Updating the value of nsslapd-db-locks was not detected
|
|
|
dc8c34 |
at the server's startup time. As suggested in
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47934#comment:1
|
|
|
dc8c34 |
the value is stored in the guardian file as "locks:20000" at the shut-
|
|
|
dc8c34 |
down time. When restarting the server, the nsslapd-db-locks value in
|
|
|
dc8c34 |
cn=config,cn=ldbm database,cn=plugins,cn=config is compared with the
|
|
|
dc8c34 |
stored value (20000, in this example) and if they don't match, the
|
|
|
dc8c34 |
lock table is recreated. The change is logged in the error log:
|
|
|
dc8c34 |
[...] - resizing max db lock count: 20000 -> 30000
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47934
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit f4437defacf8812c5f95869147a99f8412dc4a07)
|
|
|
dc8c34 |
(cherry picked from commit dc4185ea40e1f1b8527a67a0c854fcc29b8bafe7)
|
|
|
dc8c34 |
(cherry picked from commit d1e4698530868532bd472c70ca8ccc4a317b4199)
|
|
|
dc8c34 |
(cherry picked from commit 86b728f88fe0d35f403c012166f98c3a0e69ad32)
|
|
|
dc8c34 |
(cherry picked from commit 295cf31602797b09a3b7a7c7e8d2feb71017522b)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/back-ldbm/dblayer.c | 33 ++++++++++++++++++++++--------
|
|
|
dc8c34 |
ldap/servers/slapd/back-ldbm/dblayer.h | 2 ++
|
|
|
dc8c34 |
ldap/servers/slapd/back-ldbm/ldbm_config.c | 4 ++--
|
|
|
dc8c34 |
3 files changed, 29 insertions(+), 10 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
dc8c34 |
index 6f66a75..b25fccb 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
dc8c34 |
@@ -1069,6 +1069,8 @@ static void dblayer_dump_config_tracing(dblayer_private *priv)
|
|
|
dc8c34 |
LDAPDebug(LDAP_DEBUG_TRACE,"private import mem=%d\n",priv->dblayer_private_import_mem,0,0);
|
|
|
dc8c34 |
LDAPDebug(LDAP_DEBUG_TRACE,"shm_key=%ld\n",priv->dblayer_shm_key,0,0);
|
|
|
dc8c34 |
LDAPDebug(LDAP_DEBUG_TRACE,"lockdown=%d\n",priv->dblayer_lockdown,0,0);
|
|
|
dc8c34 |
+ LDAPDebug(LDAP_DEBUG_TRACE,"locks=%d\n",priv->dblayer_lock_config,0,0);
|
|
|
dc8c34 |
+ LDAPDebug(LDAP_DEBUG_TRACE,"previous_locks=%d\n",priv->dblayer_previous_lock_config,0,0);
|
|
|
dc8c34 |
LDAPDebug(LDAP_DEBUG_TRACE,"tx_max=%d\n",priv->dblayer_tx_max,0,0);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -1597,13 +1599,24 @@ dblayer_start(struct ldbminfo *li, int dbmode)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/* Is the cache being re-sized ? (If we're just doing an archive or export,
|
|
|
dc8c34 |
* we don't care if the cache is being re-sized) */
|
|
|
dc8c34 |
- if ( (priv->dblayer_previous_cachesize || priv->dblayer_previous_ncache) &&
|
|
|
dc8c34 |
- ((priv->dblayer_cachesize != priv->dblayer_previous_cachesize) ||
|
|
|
dc8c34 |
- (priv->dblayer_ncache != priv->dblayer_previous_ncache)) &&
|
|
|
dc8c34 |
- !(dbmode & (DBLAYER_ARCHIVE_MODE|DBLAYER_EXPORT_MODE)) ) {
|
|
|
dc8c34 |
- LDAPDebug(LDAP_DEBUG_ANY,
|
|
|
dc8c34 |
- "I'm resizing my cache now...cache was %lu and is now %lu\n",
|
|
|
dc8c34 |
+ if ((priv->dblayer_previous_cachesize || priv->dblayer_previous_ncache) &&
|
|
|
dc8c34 |
+ (priv->dblayer_previous_lock_config) &&
|
|
|
dc8c34 |
+ ((priv->dblayer_cachesize != priv->dblayer_previous_cachesize) ||
|
|
|
dc8c34 |
+ (priv->dblayer_ncache != priv->dblayer_previous_ncache) ||
|
|
|
dc8c34 |
+ (priv->dblayer_lock_config != priv->dblayer_previous_lock_config)) &&
|
|
|
dc8c34 |
+ !(dbmode & (DBLAYER_ARCHIVE_MODE|DBLAYER_EXPORT_MODE)) ) {
|
|
|
dc8c34 |
+ if (priv->dblayer_cachesize != priv->dblayer_previous_cachesize) {
|
|
|
dc8c34 |
+ LDAPDebug(LDAP_DEBUG_ANY, "resizing db cache size: %lu -> %lu\n",
|
|
|
dc8c34 |
priv->dblayer_previous_cachesize, priv->dblayer_cachesize, 0);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (priv->dblayer_ncache != priv->dblayer_previous_ncache) {
|
|
|
dc8c34 |
+ LDAPDebug(LDAP_DEBUG_ANY, "resizing db cache count: %d -> %d\n",
|
|
|
dc8c34 |
+ priv->dblayer_previous_ncache, priv->dblayer_ncache, 0);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (priv->dblayer_lock_config != priv->dblayer_previous_lock_config) {
|
|
|
dc8c34 |
+ LDAPDebug(LDAP_DEBUG_ANY, "resizing max db lock count: %d -> %d\n",
|
|
|
dc8c34 |
+ priv->dblayer_previous_lock_config, priv->dblayer_lock_config, 0);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
dblayer_reset_env(li);
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Once pEnv->remove (via dblayer_reset_env) has been called,
|
|
|
dc8c34 |
@@ -4786,8 +4799,8 @@ static int commit_good_database(dblayer_private *priv)
|
|
|
dc8c34 |
filename, PR_GetError(), slapd_pr_strerror(PR_GetError()) );
|
|
|
dc8c34 |
return -1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- PR_snprintf(line,sizeof(line),"cachesize:%lu\nncache:%d\nversion:%d\n",
|
|
|
dc8c34 |
- priv->dblayer_cachesize, priv->dblayer_ncache, DB_VERSION_MAJOR);
|
|
|
dc8c34 |
+ PR_snprintf(line,sizeof(line),"cachesize:%lu\nncache:%d\nversion:%d\nlocks:%d\n",
|
|
|
dc8c34 |
+ (long unsigned int)priv->dblayer_cachesize, priv->dblayer_ncache, DB_VERSION_MAJOR, priv->dblayer_lock_config);
|
|
|
dc8c34 |
num_bytes = strlen(line);
|
|
|
dc8c34 |
return_value = slapi_write_buffer(prfd, line, num_bytes);
|
|
|
dc8c34 |
if (return_value != num_bytes)
|
|
|
dc8c34 |
@@ -4833,6 +4846,7 @@ static int read_metadata(struct ldbminfo *li)
|
|
|
dc8c34 |
* priv->dblayer_recovery_required = 0; */
|
|
|
dc8c34 |
priv->dblayer_previous_cachesize = 0;
|
|
|
dc8c34 |
priv->dblayer_previous_ncache = 0;
|
|
|
dc8c34 |
+ priv->dblayer_previous_lock_config = 0;
|
|
|
dc8c34 |
/* Open the guard file and read stuff, then delete it */
|
|
|
dc8c34 |
PR_snprintf(filename,sizeof(filename),"%s/guardian",priv->dblayer_home_directory);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -4902,6 +4916,9 @@ static int read_metadata(struct ldbminfo *li)
|
|
|
dc8c34 |
number = atoi(value);
|
|
|
dc8c34 |
priv->dblayer_previous_ncache = number;
|
|
|
dc8c34 |
} else if (0 == strcmp("version",attribute)) {
|
|
|
dc8c34 |
+ } else if (0 == strcmp("locks",attribute)) {
|
|
|
dc8c34 |
+ number = atoi(value);
|
|
|
dc8c34 |
+ priv->dblayer_previous_lock_config = number;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if (NULL == nextline || '\0' == *nextline) {
|
|
|
dc8c34 |
/* Nothing more to read */
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h
|
|
|
dc8c34 |
index 4ff9d53..3e4f4d8 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/back-ldbm/dblayer.h
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/back-ldbm/dblayer.h
|
|
|
dc8c34 |
@@ -178,6 +178,8 @@ struct dblayer_private
|
|
|
dc8c34 |
PRCondVar *thread_count_cv; /* condition variable for housekeeping thread shutdown */
|
|
|
dc8c34 |
int dblayer_lockdown; /* use DB_LOCKDOWN */
|
|
|
dc8c34 |
int dblayer_lock_config;
|
|
|
dc8c34 |
+ int dblayer_previous_lock_config;/* Max lock count when we last shut down--
|
|
|
dc8c34 |
+ * used to determine if we delete the mpool */
|
|
|
dc8c34 |
u_int32_t dblayer_deadlock_policy; /* i.e. the atype to DB_ENV->lock_detect in deadlock_threadmain */
|
|
|
dc8c34 |
};
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
dc8c34 |
index 11aa42d..462b0a1 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
dc8c34 |
@@ -948,7 +948,7 @@ static int ldbm_config_db_lock_set(void *arg, void *value, char *errorbuf, int p
|
|
|
dc8c34 |
if (apply) {
|
|
|
dc8c34 |
if (CONFIG_PHASE_RUNNING == phase) {
|
|
|
dc8c34 |
li->li_dblayer_private->dblayer_lock_config = val;
|
|
|
dc8c34 |
- LDAPDebug(LDAP_DEBUG_ANY, "New db cache size will not take affect until the server is restarted\n", 0, 0, 0);
|
|
|
dc8c34 |
+ LDAPDebug(LDAP_DEBUG_ANY, "New db max lock count will not take affect until the server is restarted\n", 0, 0, 0);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
li->li_dblayer_private->dblayer_lock_config = val;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1390,7 +1390,7 @@ static config_info ldbm_config[] = {
|
|
|
dc8c34 |
{CONFIG_DB_VERBOSE, CONFIG_TYPE_ONOFF, "off", &ldbm_config_db_verbose_get, &ldbm_config_db_verbose_set, 0},
|
|
|
dc8c34 |
{CONFIG_DB_DEBUG, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_debug_get, &ldbm_config_db_debug_set, 0},
|
|
|
dc8c34 |
{CONFIG_DB_NAMED_REGIONS, CONFIG_TYPE_ONOFF, "off", &ldbm_config_db_named_regions_get, &ldbm_config_db_named_regions_set, 0},
|
|
|
dc8c34 |
- {CONFIG_DB_LOCK, CONFIG_TYPE_INT, "10000", &ldbm_config_db_lock_get, &ldbm_config_db_lock_set, 0},
|
|
|
dc8c34 |
+ {CONFIG_DB_LOCK, CONFIG_TYPE_INT, "10000", &ldbm_config_db_lock_get, &ldbm_config_db_lock_set, CONFIG_FLAG_ALWAYS_SHOW},
|
|
|
dc8c34 |
{CONFIG_DB_PRIVATE_MEM, CONFIG_TYPE_ONOFF, "off", &ldbm_config_db_private_mem_get, &ldbm_config_db_private_mem_set, 0},
|
|
|
dc8c34 |
{CONFIG_DB_PRIVATE_IMPORT_MEM, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_private_import_mem_get, &ldbm_config_db_private_import_mem_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
|
|
|
dc8c34 |
{CONDIF_DB_ONLINE_IMPORT_ENCRYPT, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_online_import_encrypt_get, &ldbm_config_db_online_import_encrypt_set, 0},
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.9.3
|
|
|
dc8c34 |
|