ldap/servers/slapd/back-ldbm/back-ldbm.h | 3
ldap/servers/slapd/back-ldbm/cache.c | 22 --
ldap/servers/slapd/back-ldbm/instance.c | 1
ldap/servers/slapd/back-ldbm/ldbm_config.c | 162 --------------------
ldap/servers/slapd/back-ldbm/ldbm_config.h | 3
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 81 ----------
6 files changed, 18 insertions(+), 254 deletions(-)
New commits:
commit 7a7c52755df065d41dd725f68f57c4326113cfc7
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 22 16:55:51 2011 -0800
Cancelling commit aef19508c4f618285116d2068655183658f564d9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Feb 21 17:46:21 2011 -0800
Bug 450016 - RFE- Console display values in KB/MB/GB
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h
b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index b2f0b50..adf593e 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -634,8 +634,6 @@ struct ldbminfo {
int li_fat_lock; /* 608146 -- make this configurable, first */
int li_legacy_errcode; /* 615428 -- in case legacy err code is expected */
Slapi_Counter *li_global_usn_counter; /* global USN counter */
- char *dbcache_display_unit; /* display unit for db cache */
- char *importcache_display_unit; /* display unit for db import cache */
};
/* li_flags could store these bits defined in ../slapi-plugin.h
@@ -766,7 +764,6 @@ typedef struct ldbm_instance {
int require_index; /* set to 1 to require an index be used
* in search */
struct cache inst_dncache; /* The dn cache for this instance. */
- char *cache_display_unit; /* display unit for client */
} ldbm_instance;
/*
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index 5406ace..f21cd87 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/ldap/servers/slapd/back-ldbm/cache.c
@@ -667,14 +667,10 @@ static void entrycache_set_max_size(struct cache *cache, size_t
bytes)
struct backentry *eflushtemp = NULL;
if (bytes < MINCACHESIZE) {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "WARNING -- Max entry cache size %lu is set; "
- "Minimum entry cache size is %lu -- rounding up\n",
- bytes, MINCACHESIZE);
bytes = MINCACHESIZE;
- } else {
- LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM,
- "Max entry cache size is set to %lu\n", bytes);
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "WARNING -- Minimum cache size is %lu -- rounding up\n",
+ MINCACHESIZE, 0, 0);
}
PR_Lock(cache->c_mutex);
cache->c_maxsize = bytes;
@@ -1501,18 +1497,14 @@ dncache_set_max_size(struct cache *cache, size_t bytes)
}
if (bytes < MINCACHESIZE) {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "WARNING -- Max dn cache size %lu is set; "
- "Minimum dn cache size is %lu -- rounding up\n",
- bytes, MINCACHESIZE);
bytes = MINCACHESIZE;
- } else {
- LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM,
- "Max dn cache size is set to %lu\n", bytes);
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "WARNING -- Minimum cache size is %lu -- rounding up\n",
+ MINCACHESIZE, 0, 0);
}
PR_Lock(cache->c_mutex);
cache->c_maxsize = bytes;
- LOG("dn cache size set to %lu\n", bytes, 0, 0);
+ LOG("entry cache size set to %lu\n", bytes, 0, 0);
/* check for full cache, and clear out if necessary */
if (CACHE_FULL(cache)) {
dnflush = dncache_flush(cache);
diff --git a/ldap/servers/slapd/back-ldbm/instance.c
b/ldap/servers/slapd/back-ldbm/instance.c
index daeec3b..da66565 100644
--- a/ldap/servers/slapd/back-ldbm/instance.c
+++ b/ldap/servers/slapd/back-ldbm/instance.c
@@ -71,7 +71,6 @@ int ldbm_instance_create(backend *be, char *name)
rc = -1;
goto error;
}
- inst->cache_display_unit = slapi_ch_strdup("bytes");
/*
* initialize the dn cache
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c
b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index fff84d5..a1b4062 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -326,28 +326,19 @@ done:
return retval;
}
-static void *
-ldbm_config_dbcachesize_get(void *arg)
+static void *ldbm_config_dbcachesize_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
- if (NULL == li) {
- return (void *)NULL;
- }
-
return (void *) (li->li_new_dbcachesize);
}
-static int
-ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, int phase,
int apply)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
+ int retval = LDAP_SUCCESS;
size_t val = (size_t) value;
- if (NULL == li) {
- return LDAP_PARAM_ERROR;
- }
-
if (apply) {
/* Stop the user configuring a stupidly small cache */
/* min: 8KB (page size) * def thrd cnts (threadnumber==20). */
@@ -367,69 +358,7 @@ ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf,
int phase, i
}
- return LDAP_SUCCESS;
-}
-
-static void *
-ldbm_config_dbcachesizeunit_get(void *arg)
-{
- struct ldbminfo *li = (struct ldbminfo *) arg;
-
- if (NULL == li) {
- return (void *)NULL;
- }
- return (void *)slapi_ch_strdup(li->dbcache_display_unit);
-}
-
-static int
-ldbm_config_dbcachesizeunit_set(void *arg, void *value, char *errorbuf, int phase, int
apply)
-{
- struct ldbminfo *li = (struct ldbminfo *) arg;
- char *val = (char *)value;
-
- if (NULL == li) {
- return LDAP_PARAM_ERROR;
- }
-
- if (NULL == val) {
- val = "bytes"; /* default unit */
- } else if ((0 == strcasecmp(val, "bytes")) ||
- (0 == strcasecmp(val, "KB")) ||
- (0 == strcasecmp(val, "MB")) ||
- (0 == strcasecmp(val, "GB"))) {
- ;
- } else {
- if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
- (0 == strncasecmp(val, "kilo", 4))) {
- val = "KB";
- } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
- (0 == strncasecmp(val, "mega", 4))) {
- val = "MB";
- } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
- (0 == strncasecmp(val, "giga", 4))) {
- val = "GB";
- } else {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "WARNING: \"%s: %s\" is not a correct unit.
"
- "Replacing it with \"bytes\".\n",
- CONFIG_DBCACHESIZEUNIT, val);
- val = "bytes"; /* default unit */
- }
- }
-
- if (apply) {
- if (li->dbcache_display_unit) {
- if (strcasecmp(li->dbcache_display_unit, val)) {
- /* units do not match; replace it */
- slapi_ch_free_string(&li->dbcache_display_unit);
- li->dbcache_display_unit = slapi_ch_strdup(val);
- }
- } else {
- li->dbcache_display_unit = slapi_ch_strdup(val);
- }
- }
-
- return LDAP_SUCCESS;
+ return retval;
}
static void *ldbm_config_maxpassbeforemerge_get(void *arg)
@@ -1044,89 +973,16 @@ static void *ldbm_config_import_cachesize_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
- if (NULL == li) {
- return (void *)NULL;
- }
-
- return (void *) (li->li_import_cachesize);
+ return (void *)(li->li_import_cachesize);
}
static int ldbm_config_import_cachesize_set(void *arg, void *value, char *errorbuf,
int phase, int apply)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
- size_t val = (size_t) value;
-
- if (NULL == li) {
- return LDAP_PARAM_ERROR;
- }
-
- if (apply) {
- li->li_import_cachesize = val;
- }
- return LDAP_SUCCESS;
-}
-
-static void *
-ldbm_config_import_cachesizeunit_get(void *arg)
-{
- struct ldbminfo *li = (struct ldbminfo *) arg;
-
- if (NULL == li) {
- return (void *)NULL;
- }
-
- return (void *)slapi_ch_strdup(li->importcache_display_unit);
-}
-
-static int
-ldbm_config_import_cachesizeunit_set(void *arg, void *value, char *errorbuf, int phase,
int apply)
-{
- struct ldbminfo *li = (struct ldbminfo *) arg;
- char *val = (char *)value;
-
- if (NULL == li) {
- return LDAP_PARAM_ERROR;
- }
-
- if (NULL == val) {
- val = "bytes"; /* default unit */
- } else if ((0 == strcasecmp(val, "bytes")) ||
- (0 == strcasecmp(val, "KB")) ||
- (0 == strcasecmp(val, "MB")) ||
- (0 == strcasecmp(val, "GB"))) {
- ;
- } else {
- if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
- (0 == strncasecmp(val, "kilo", 4))) {
- val = "KB";
- } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
- (0 == strncasecmp(val, "mega", 4))) {
- val = "MB";
- } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
- (0 == strncasecmp(val, "giga", 4))) {
- val = "GB";
- } else {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "WARNING: \"%s: %s\" is not a correct unit.
"
- "Replacing it with \"bytes\".\n",
- CONFIG_IMPORT_CACHESIZEUNIT, val);
- val = "bytes"; /* default unit */
- }
- }
-
- if (apply) {
- if (li->importcache_display_unit) {
- if (strcasecmp(li->importcache_display_unit, val)) {
- /* units do not match; replace it */
- slapi_ch_free_string(&li->importcache_display_unit);
- li->importcache_display_unit = slapi_ch_strdup(val);
- }
- } else {
- li->importcache_display_unit = slapi_ch_strdup(val);
- }
- }
+ if (apply)
+ li->li_import_cachesize = (size_t)value;
return LDAP_SUCCESS;
}
@@ -1377,8 +1233,6 @@ static config_info ldbm_config[] = {
{CONFIG_MODE, CONFIG_TYPE_INT_OCTAL, "0600", &ldbm_config_mode_get,
&ldbm_config_mode_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IDLISTSCANLIMIT, CONFIG_TYPE_INT, "4000",
&ldbm_config_allidsthreshold_get, &ldbm_config_allidsthreshold_set,
CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_DIRECTORY, CONFIG_TYPE_STRING, "", &ldbm_config_directory_get,
&ldbm_config_directory_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE|CONFIG_FLAG_SKIP_DEFAULT_SETTING},
- /* UNIT must be set before CONFIG_DBCACHESIZE is */
- {CONFIG_DBCACHESIZEUNIT, CONFIG_TYPE_STRING, NULL,
&ldbm_config_dbcachesizeunit_get, &ldbm_config_dbcachesizeunit_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DBCACHESIZE, CONFIG_TYPE_SIZE_T, "10000000",
&ldbm_config_dbcachesize_get, &ldbm_config_dbcachesize_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DBNCACHE, CONFIG_TYPE_INT, "0", &ldbm_config_dbncache_get,
&ldbm_config_dbncache_set, CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_MAXPASSBEFOREMERGE, CONFIG_TYPE_INT, "100",
&ldbm_config_maxpassbeforemerge_get, &ldbm_config_maxpassbeforemerge_set, 0},
@@ -1410,8 +1264,6 @@ static config_info ldbm_config[] = {
{CONFIG_IMPORT_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "-1",
&ldbm_config_import_cache_autosize_get, &ldbm_config_import_cache_autosize_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "0",
&ldbm_config_cache_autosize_get, &ldbm_config_cache_autosize_set, 0},
{CONFIG_CACHE_AUTOSIZE_SPLIT, CONFIG_TYPE_INT, "50",
&ldbm_config_cache_autosize_split_get, &ldbm_config_cache_autosize_split_set, 0},
- /* UNIT must be set before CONFIG_IMPORT_CACHESIZE is */
- {CONFIG_IMPORT_CACHESIZEUNIT, CONFIG_TYPE_STRING, NULL,
&ldbm_config_import_cachesizeunit_get, &ldbm_config_import_cachesizeunit_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IMPORT_CACHESIZE, CONFIG_TYPE_SIZE_T, "20000000",
&ldbm_config_import_cachesize_get, &ldbm_config_import_cachesize_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IDL_SWITCH, CONFIG_TYPE_STRING, "new",
&ldbm_config_idl_get_idl_new, &ldbm_config_idl_set_tune,
CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_BYPASS_FILTER_TEST, CONFIG_TYPE_STRING, "on",
&ldbm_config_get_bypass_filter_test, &ldbm_config_set_bypass_filter_test,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h
b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index e5c6113..5ba52a6 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -89,14 +89,12 @@ struct config_info {
#define CONFIG_DIRECTORY "nsslapd-directory"
#define CONFIG_MODE "nsslapd-mode"
#define CONFIG_DBCACHESIZE "nsslapd-dbcachesize"
-#define CONFIG_DBCACHESIZEUNIT "nsslapd-dbcachesizeunit"
#define CONFIG_DBNCACHE "nsslapd-dbncache"
#define CONFIG_MAXPASSBEFOREMERGE "nsslapd-maxpassbeforemerge"
#define CONFIG_IMPORT_CACHE_AUTOSIZE "nsslapd-import-cache-autosize"
#define CONFIG_CACHE_AUTOSIZE "nsslapd-cache-autosize"
#define CONFIG_CACHE_AUTOSIZE_SPLIT "nsslapd-cache-autosize-split"
#define CONFIG_IMPORT_CACHESIZE "nsslapd-import-cachesize"
-#define CONFIG_IMPORT_CACHESIZEUNIT "nsslapd-import-cachesizeunit"
#define CONFIG_INDEX_BUFFER_SIZE "nsslapd-index-buffer-size"
#define CONFIG_EXCLUDE_FROM_EXPORT "nsslapd-exclude-from-export"
#define CONFIG_EXCLUDE_FROM_EXPORT_DEFAULT_VALUE \
@@ -148,7 +146,6 @@ struct config_info {
/* instance config options */
#define CONFIG_INSTANCE_CACHESIZE "nsslapd-cachesize"
#define CONFIG_INSTANCE_CACHEMEMSIZE "nsslapd-cachememsize"
-#define CONFIG_INSTANCE_CACHEMEMSIZEUNIT "nsslapd-cachememsizeunit"
#define CONFIG_INSTANCE_DNCACHEMEMSIZE "nsslapd-dncachememsize"
#define CONFIG_INSTANCE_SUFFIX "nsslapd-suffix"
#define CONFIG_INSTANCE_READONLY "nsslapd-readonly"
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 7d104ce..882f10a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -111,11 +111,7 @@ static void *
ldbm_instance_config_cachememsize_get(void *arg)
{
ldbm_instance *inst = (ldbm_instance *) arg;
-
- if (NULL == inst) {
- return (void *)NULL;
- }
-
+
return (void *) cache_get_max_size(&(inst->inst_cache));
}
@@ -123,83 +119,16 @@ static int
ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, int phase,
int apply)
{
ldbm_instance *inst = (ldbm_instance *) arg;
+ int retval = LDAP_SUCCESS;
size_t val = (size_t) value;
- if (NULL == inst) {
- return LDAP_PARAM_ERROR;
- }
+ /* Do whatever we can to make sure the data is ok. */
if (apply) {
- LDAPDebug2Args(LDAP_DEBUG_ANY, "Instance %s: "
- "Max entry cache size is set to %lu (bytes)\n",
- inst->inst_name, val);
cache_set_max_size(&(inst->inst_cache), val, CACHE_TYPE_ENTRY);
}
- return LDAP_SUCCESS;
-}
-
-static void *
-ldbm_instance_config_cachememsizeunit_get(void *arg)
-{
- ldbm_instance *inst = (ldbm_instance *) arg;
-
- if (NULL == inst) {
- return (void *)NULL;
- }
- return (void *)slapi_ch_strdup(inst->cache_display_unit);
-}
-
-static int
-ldbm_instance_config_cachememsizeunit_set(void *arg, void *value, char *errorbuf, int
phase, int apply)
-{
- ldbm_instance *inst = (ldbm_instance *) arg;
- char *val = (char *)value;
- size_t cachememsize;
-
- if (NULL == inst) {
- return LDAP_PARAM_ERROR;
- }
-
- if (NULL == val) {
- val = "bytes"; /* default unit */
- } else if ((0 == strcasecmp(val, "bytes")) ||
- (0 == strcasecmp(val, "KB")) ||
- (0 == strcasecmp(val, "MB")) ||
- (0 == strcasecmp(val, "GB"))) {
- ;
- } else {
- if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
- (0 == strncasecmp(val, "kilo", 4))) {
- val = "KB";
- } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
- (0 == strncasecmp(val, "mega", 4))) {
- val = "MB";
- } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
- (0 == strncasecmp(val, "giga", 4))) {
- val = "GB";
- } else {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "WARNING: \"%s: %s\" is not a correct unit.
"
- "Replacing it with \"bytes\".\n",
- CONFIG_INSTANCE_CACHEMEMSIZEUNIT, val);
- val = "bytes"; /* default unit */
- }
- }
-
- if (apply) {
- if (inst->cache_display_unit) {
- if (strcasecmp(inst->cache_display_unit, val)) {
- /* units do not match; replace it */
- slapi_ch_free_string(&inst->cache_display_unit);
- inst->cache_display_unit = slapi_ch_strdup(val);
- }
- } else {
- inst->cache_display_unit = slapi_ch_strdup(val);
- }
- }
-
- return LDAP_SUCCESS;
+ return retval;
}
static void *
@@ -359,8 +288,6 @@ ldbm_instance_config_require_index_set(void *arg, void *value, char
*errorbuf, i
*----------------------------------------------------------------------*/
static config_info ldbm_instance_config[] = {
{CONFIG_INSTANCE_CACHESIZE, CONFIG_TYPE_LONG, "-1",
&ldbm_instance_config_cachesize_get, &ldbm_instance_config_cachesize_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
- /* UNIT must be set before CACHEMEMSIZE is */
- {CONFIG_INSTANCE_CACHEMEMSIZEUNIT, CONFIG_TYPE_STRING, NULL,
&ldbm_instance_config_cachememsizeunit_get,
&ldbm_instance_config_cachememsizeunit_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_CACHEMEMSIZE, CONFIG_TYPE_SIZE_T, "10485760",
&ldbm_instance_config_cachememsize_get, &ldbm_instance_config_cachememsize_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_READONLY, CONFIG_TYPE_ONOFF, "off",
&ldbm_instance_config_readonly_get, &ldbm_instance_config_readonly_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_REQUIRE_INDEX, CONFIG_TYPE_ONOFF, "off",
&ldbm_instance_config_require_index_get, &ldbm_instance_config_require_index_set,
CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},