浏览代码

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.

Noriko Hosoi 15 年之前
父节点
当前提交
3604c48b86

+ 7 - 1
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;
 	}

+ 12 - 0
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;

+ 4 - 1
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