ldap/servers/slapd/back-ldbm/back-ldbm.h | 1
ldap/servers/slapd/back-ldbm/idl.c | 24 +++++++++++++----------
ldap/servers/slapd/back-ldbm/ldbm_config.c | 30 ++++++++++++++++++++++++++++-
ldap/servers/slapd/back-ldbm/ldbm_config.h | 1
4 files changed, 45 insertions(+), 11 deletions(-)
New commits:
commit a5d3571aadde4d84d426c2c16ac9aa2b189c9bbb
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 31 15:43:32 2013 -0400
Ticket 47372 - make old-idl tunable
Bug Description: With the change from ticket 47326 old-idl is working, but tests
showed that performance heavily depends on the size of the idlists.
So idl_maxids should be made configurable.
Fix Description: Added a new config ldbm config setting,
"nsslapd-old-idl-maxids".
If this is not set, which is the default value, then we calulate it
the old way, otherwise the config setting is used.
https://fedorahosted.org/389/ticket/47372
Reviewed by: ?
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h
b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index e565360..b0f87e1 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -653,6 +653,7 @@ struct ldbminfo {
int li_rangelookthroughlimit;
int li_reslimit_rangelookthrough_handle;
int li_idl_update;
+ int li_old_idl_maxids;
};
/* li_flags could store these bits defined in ../slapi-plugin.h
diff --git a/ldap/servers/slapd/back-ldbm/idl.c b/ldap/servers/slapd/back-ldbm/idl.c
index 65fca7c..0a11d88 100644
--- a/ldap/servers/slapd/back-ldbm/idl.c
+++ b/ldap/servers/slapd/back-ldbm/idl.c
@@ -89,17 +89,21 @@ size_t idl_old_get_allidslimit(struct attrinfo *a)
static void idl_init_maxids(struct ldbminfo *li,idl_private *priv)
{
- const size_t blksize = dblayer_get_optimal_block_size(li);
+ const size_t blksize = dblayer_get_optimal_block_size(li);
- if (0 == li->li_allidsthreshold) {
- li->li_allidsthreshold = DEFAULT_ALLIDSTHRESHOLD;
- }
- priv->idl_maxids = (blksize / sizeof(ID)) - 2;
- priv->idl_maxindirect = (li->li_allidsthreshold / priv->idl_maxids) + 1;
- priv->idl_allidslimit = (priv->idl_maxids * priv->idl_maxindirect);
- LDAPDebug (LDAP_DEBUG_ARGS,
- "idl_init_private: blksize %lu, maxids %i, maxindirect %i\n",
- (unsigned long)blksize, priv->idl_maxids, priv->idl_maxindirect);
+ if (0 == li->li_allidsthreshold) {
+ li->li_allidsthreshold = DEFAULT_ALLIDSTHRESHOLD;
+ }
+ if(li->li_old_idl_maxids){
+ priv->idl_maxids = li->li_old_idl_maxids;
+ } else {
+ priv->idl_maxids = (blksize / sizeof(ID)) - 2;
+ }
+ priv->idl_maxindirect = (li->li_allidsthreshold / priv->idl_maxids) + 1;
+ priv->idl_allidslimit = (priv->idl_maxids * priv->idl_maxindirect);
+ LDAPDebug (LDAP_DEBUG_ARGS,
+ "idl_init_private: blksize %lu, maxids %i, maxindirect %i\n",
+ (unsigned long)blksize, priv->idl_maxids, priv->idl_maxindirect);
}
/* routine to initialize the private data used by the IDL code per-attribute */
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c
b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 08fc536..056c14c 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -165,7 +165,7 @@ static int ldbm_config_lookthroughlimit_set(void *arg, void *value,
char *errorb
return retval;
}
-static void *ldbm_config_pagedlookthroughlimit_get(void *arg)
+static void *ldbm_config_pagedlookthroughlimit_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
@@ -718,6 +718,33 @@ static int ldbm_config_db_idl_divisor_set(void *arg, void *value,
char *errorbuf
return retval;
}
+static void *ldbm_config_db_old_idl_maxids_get(void *arg)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+
+ return (void *) ((uintptr_t)li->li_old_idl_maxids);
+}
+
+static int ldbm_config_db_old_idl_maxids_set(void *arg, void *value, char *errorbuf, int
phase, int apply)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+ int retval = LDAP_SUCCESS;
+ int val = (int) ((uintptr_t)value);
+
+ if (apply) {
+ if(val >= 0){
+ li->li_old_idl_maxids = val;
+ } else {
+ PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "Error: Invalid value for %s (%d). Value must be equal or
greater than zero.",
+ CONFIG_DB_OLD_IDL_MAXIDS, val);
+ return LDAP_UNWILLING_TO_PERFORM;
+ }
+ }
+
+ return retval;
+}
+
static void *ldbm_config_db_logfile_size_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
@@ -1352,6 +1379,7 @@ static config_info ldbm_config[] = {
{CONFIG_DB_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0",
&ldbm_config_db_page_size_get, &ldbm_config_db_page_size_set, 0},
{CONFIG_DB_INDEX_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0",
&ldbm_config_db_index_page_size_get, &ldbm_config_db_index_page_size_set, 0},
{CONFIG_DB_IDL_DIVISOR, CONFIG_TYPE_INT, "0",
&ldbm_config_db_idl_divisor_get, &ldbm_config_db_idl_divisor_set, 0},
+ {CONFIG_DB_OLD_IDL_MAXIDS, CONFIG_TYPE_INT, "0",
&ldbm_config_db_old_idl_maxids_get, &ldbm_config_db_old_idl_maxids_set, 0},
{CONFIG_DB_LOGFILE_SIZE, CONFIG_TYPE_SIZE_T, "0",
&ldbm_config_db_logfile_size_get, &ldbm_config_db_logfile_size_set, 0},
{CONFIG_DB_TRICKLE_PERCENTAGE, CONFIG_TYPE_INT, "5",
&ldbm_config_db_trickle_percentage_get, &ldbm_config_db_trickle_percentage_set,
0},
{CONFIG_DB_SPIN_COUNT, CONFIG_TYPE_INT, "0",
&ldbm_config_db_spin_count_get, &ldbm_config_db_spin_count_set, 0},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h
b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index 17883cb..456d27d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -123,6 +123,7 @@ struct config_info {
But 8K is still a good page size for id2entry. So we now allow different
page sizes for the primary and secondary indices. */
#define CONFIG_DB_IDL_DIVISOR "nsslapd-db-idl-divisor"
+#define CONFIG_DB_OLD_IDL_MAXIDS "nsslapd-db-old-idl-maxids"
#define CONFIG_DB_LOGFILE_SIZE "nsslapd-db-logfile-size"
#define CONFIG_DB_TRICKLE_PERCENTAGE "nsslapd-db-trickle-percentage"
#define CONFIG_DB_SPIN_COUNT "nsslapd-db-spin-count"