This is an automated email from the git hooks/post-receive script.
lkrispen pushed a commit to branch 389-ds-base-1.4.2
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.2 by this push:
new e8d8000 Ticket: 50755 - setting nsslapd-db-home-directory is overriding db_directory
e8d8000 is described below
commit e8d800073566a854e06bedd71d9ae48d9e893453
Author: Ludwig Krispenz <lkrispen@redhat.com>
AuthorDate: Thu Dec 19 14:33:52 2019 +0100
Ticket: 50755 - setting nsslapd-db-home-directory is overriding db_directory
Bug: If nsslapd-db-home-directory is set for new instances the database is
placed below this directory, not only the db environment.
Fix: Use the db dir when looking up the instance dir.
Make sure the log dir is below db dir and not home dir.
Make sure dse.ldif is written if upgrade to split config
is done in a non-normal mode, eg import
Make sure the db directory is set to the list of parent
directories for instances
If dblayer is closed only temporarily do not free directory settings
Adjust log level of some error messages
Reviewed by: Mark, thanks
---
ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c | 7 +++-
ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c | 44 ++++++++++++++++++------
ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h | 1 +
ldap/servers/slapd/back-ldbm/dblayer.c | 2 +-
ldap/servers/slapd/back-ldbm/ldbm_config.c | 2 +-
ldap/servers/slapd/slapi-plugin.h | 1 +
6 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c
index c33c41b..4289134 100644
--- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c
+++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_config.c
@@ -1433,7 +1433,7 @@ bdb_config_upgrade_dse_info(struct ldbminfo *li)
int rval = 0;
Slapi_Mods smods;
- slapi_log_err(SLAPI_LOG_ERR, "bdb_config_upgrade_dse_info", "create config entry from old config\n");
+ slapi_log_err(SLAPI_LOG_INFO, "bdb_config_upgrade_dse_info", "create config entry from old config\n");
/* first get the existing ldbm config entry, if it fails
* nothing can be done
@@ -1477,6 +1477,11 @@ bdb_config_upgrade_dse_info(struct ldbminfo *li)
* - add them to cn=bdb,cn=config,cn=ldbm database
* - remove them from cn=config,cn=ldbm database
*/
+ /* The new and changed config entry need to be kept independent of
+ * the slapd exec mode leading here
+ */
+ dse_unset_dont_ever_write_dse_files();
+
bdb_config = slapi_entry_alloc();
bdb_config_dn = slapi_create_dn_string("cn=bdb,cn=config,cn=%s,cn=plugins,cn=config",
li->li_plugin->plg_name);
diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c
index ac45770..40161d9 100644
--- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c
+++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c
@@ -336,6 +336,15 @@ bdb_get_home_dir(struct ldbminfo *li, int *dbhome)
return home_dir;
}
+/*
+ * return the top db directory
+ */
+char *
+bdb_get_db_dir(struct ldbminfo *li)
+{
+ return li->li_directory;
+}
+
/* Helper function which deletes the persistent state of the database library
* IMHO this should be in inside libdb, but keith won't have it.
* Stop press---libdb now does delete these files on recovery, so we don't call this any more.
@@ -732,7 +741,8 @@ bdb_make_env(bdb_db_env **env, struct ldbminfo *li)
{
bdb_config *conf = (bdb_config *)li->li_dblayer_config;
bdb_db_env *pEnv;
- char *home_dir = NULL;
+ char *db_dir = NULL;
+ char *log_dir = NULL;
int ret;
Object *inst_obj;
ldbm_instance *inst = NULL;
@@ -776,17 +786,17 @@ bdb_make_env(bdb_db_env **env, struct ldbminfo *li)
}
}
}
- home_dir = bdb_get_home_dir(li, NULL);
- /* user specified db home */
- if (home_dir && *home_dir &&
- !charray_utf8_inlist(conf->bdb_data_directories, home_dir)) {
- charray_add(&(conf->bdb_data_directories), slapi_ch_strdup(home_dir));
+ /* also set the main db directory as potential parent */
+ db_dir = bdb_get_db_dir(li);
+ if (db_dir && *db_dir &&
+ !charray_utf8_inlist(conf->bdb_data_directories, db_dir)) {
+ charray_add(&(conf->bdb_data_directories), slapi_ch_strdup(db_dir));
}
/* user specified log dir */
- if (conf->bdb_log_directory && *(conf->bdb_log_directory)) {
- pEnv->bdb_DB_ENV->set_lg_dir(pEnv->bdb_DB_ENV,
- conf->bdb_log_directory);
+ log_dir = (char *)bdb_config_db_logdirectory_get_ext(li);
+ if (log_dir && *log_dir) {
+ pEnv->bdb_DB_ENV->set_lg_dir(pEnv->bdb_DB_ENV,log_dir);
}
/* set up cache sizes */
@@ -2085,8 +2095,13 @@ bdb_post_close(struct ldbminfo *li, int dbmode)
charray_free(conf->bdb_data_directories);
conf->bdb_data_directories = NULL;
}
- slapi_ch_free_string(&conf->bdb_dbhome_directory);
- slapi_ch_free_string(&conf->bdb_home_directory);
+ if (g_get_shutdown()) {
+ /* if the dblayer is closed temporarily
+ * eg. in online restore keep the directory settings
+ */
+ slapi_ch_free_string(&conf->bdb_dbhome_directory);
+ slapi_ch_free_string(&conf->bdb_home_directory);
+ }
return return_value;
}
@@ -5977,6 +5992,13 @@ bdb_get_info(Slapi_Backend *be, int cmd, void **info)
}
break;
}
+ case BACK_INFO_DB_DIRECTORY: {
+ if (li) {
+ *(char **)info = BDB_CONFIG(li)->bdb_home_directory;
+ rc = 0;
+ }
+ break;
+ }
case BACK_INFO_DBHOME_DIRECTORY: {
if (li) {
if (BDB_CONFIG(li)->bdb_dbhome_directory &&
diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h
index 91a072f..d729327 100644
--- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h
+++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.h
@@ -127,6 +127,7 @@ int bdb_get_aux_id2entry(backend *be, DB **ppDB, DB_ENV **ppEnv, char **path);
int bdb_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv, char **path, int flags);
int bdb_release_aux_id2entry(backend *be, DB *pDB, DB_ENV *pEnv);
char *bdb_get_home_dir(struct ldbminfo *li, int *dbhome);
+char *bdb_get_db_dir(struct ldbminfo *li);
int bdb_copy_directory(struct ldbminfo *li, Slapi_Task *task, char *src_dir, char *dest_dir, int restore, int *cnt, int indexonly, int is_changelog);
int bdb_remove_env(struct ldbminfo *li);
int bdb_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2);
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 3011aa0..c9f43c7 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -301,7 +301,7 @@ dblayer_get_full_inst_dir(struct ldbminfo *li, ldbm_instance *inst, char *buf, i
mylen = strlen(parent_dir) + 1;
} else {
dblayer_private *priv = li->li_dblayer_private;
- priv->dblayer_get_info_fn(inst->inst_be, BACK_INFO_DBHOME_DIRECTORY, (void **)&parent_dir);
+ priv->dblayer_get_info_fn(inst->inst_be, BACK_INFO_DB_DIRECTORY, (void **)&parent_dir);
if (!parent_dir || !*parent_dir) {
buf = NULL;
return buf;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 4672632..88c1863 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -1600,7 +1600,7 @@ ldbm_config_modify_entry_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore, Sl
returntext[0] = '\0';
- slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_modify_entry_callback", "Executing for entry (%s) with flags (%d) operation is internal: %d\n",
+ slapi_log_err(SLAPI_LOG_CONFIG, "ldbm_config_modify_entry_callback", "Executing for entry (%s) with flags (%d) operation is internal: %d\n",
slapi_entry_get_dn_const(e), li->li_flags, internal_op);
/*
* First pass: set apply mods to 0 so only input validation will be done;
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 00e426a..396d084 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -7734,6 +7734,7 @@ enum
BACK_INFO_DIRECTORY, /* Get the directory path */
BACK_INFO_LOG_DIRECTORY, /* Get the txn log directory */
BACK_INFO_INDEX_KEY, /* Get the status of a key in an index */
+ BACK_INFO_DB_DIRECTORY, /* Get the db directory */
BACK_INFO_DBHOME_DIRECTORY, /* Get the dbhome directory */
BACK_INFO_IS_ENTRYRDN /* Get the flag for entryrdn */
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org
No comments:
Post a Comment