From 3604c48b86e6b6feea63f99bebfecaa346d2bf59 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Wed, 6 Oct 2010 23:27:47 -0700 Subject: Bug 640854 - changelog db: _cl5WriteOperation: failed to write entry; db error - 22 Invalid argument https://bugzilla.redhat.com/show_bug.cgi?id=640854 Description: DBENV open flags is used to determine the DB_OPEN mode whether to set DB_AUTO_COMMIT or not. The info was eliminated in the change made for "Bug 633168 - Share backend dbEnv with the replication changelog". This patch picks up the backend dbenv openflags and uses it for the changelog DB_OPEN. --- ldap/servers/plugins/replication/cl5_api.c | 8 +++++++- ldap/servers/slapd/back-ldbm/dblayer.c | 12 ++++++++++++ ldap/servers/slapd/slapi-plugin.h | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index 79677416..b7c72292 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -1799,6 +1799,7 @@ static int _cl5AppInit (PRBool *didRecovery) int rc = -1; /* initialize to failure */ DB_ENV *dbEnv = NULL; size_t pagesize = 0; + int openflags = 0; char *cookie = NULL; Slapi_Backend *be = slapi_get_first_backend(&cookie); while (be) { @@ -1807,7 +1808,11 @@ static int _cl5AppInit (PRBool *didRecovery) rc = slapi_back_get_info(be, BACK_INFO_INDEXPAGESIZE, (void **)&pagesize); if ((LDAP_SUCCESS == rc) && pagesize) { - break; /* Successfully fetched */ + rc = slapi_back_get_info(be, + BACK_INFO_DBENV_OPENFLAGS, (void **)&openflags); + if (LDAP_SUCCESS == rc) { + break; /* Successfully fetched */ + } } } be = slapi_get_next_backend(cookie); @@ -1819,6 +1824,7 @@ static int _cl5AppInit (PRBool *didRecovery) slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5AppInit: fetched backend dbEnv (%p)\n", dbEnv); s_cl5Desc.dbEnv = dbEnv; + s_cl5Desc.dbEnvOpenFlags = openflags; s_cl5Desc.dbConfig.pageSize = pagesize; return CL5_SUCCESS; } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index cd388c9b..95d57a04 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -6411,6 +6411,18 @@ ldbm_back_get_info(Slapi_Backend *be, int cmd, void **info) } break; } + case BACK_INFO_DBENV_OPENFLAGS: + { + struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private; + if (li) { + dblayer_private *prv = (dblayer_private*)li->li_dblayer_private; + if (prv && prv->dblayer_env) { + *(int *)info = prv->dblayer_env->dblayer_openflags; + rc = 0; + } + } + break; + } case BACK_INFO_INDEXPAGESIZE: { struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private; diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 8ef2ef8d..4c5bedc5 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -6217,6 +6217,8 @@ int slapi_check_account_lock( Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, * * \note Implemented cmd: * BACK_INFO_DBENV - Get the dbenv + * BACK_INFO_DBENV_OPENFLAGS - Get the dbenv openflags + * BACK_INFO_INDEXPAGESIZE - Get the index page size */ int slapi_back_get_info(Slapi_Backend *be, int cmd, void **info); @@ -6236,7 +6238,8 @@ int slapi_back_set_info(Slapi_Backend *be, int cmd, void *info); enum { BACK_INFO_DBENV, /* Get the dbenv */ - BACK_INFO_INDEXPAGESIZE /* Get the index page size */ + BACK_INFO_INDEXPAGESIZE, /* Get the index page size */ + BACK_INFO_DBENV_OPENFLAGS/* Get the dbenv openflags */ }; #ifdef __cplusplus -- cgit