andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 3490c8cc90616422ab63716db5e92a6b1c72a961 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Thu, 11 Feb 2016 16:18:00 -0500
dc8c34
Subject: [PATCH 377/378] Ticket 47788 - Only check postop result if its a
dc8c34
 replication operation
dc8c34
dc8c34
Bug Description:  With IPA tests, without using replication, an error is
dc8c34
                  being triggered that is stoipping nomral updates from
dc8c34
                  going through.
dc8c34
dc8c34
Fix Description:  Move the error checking up into the code block above
dc8c34
                  which only executes for replicated operations.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47788
dc8c34
dc8c34
Reviewed by: nhosoi & tbordaz(Thanks!!)
dc8c34
dc8c34
(cherry picked from commit d7b598da2eff95070936bf7c3e01bcd11c44ed60)
dc8c34
(cherry picked from commit 8817a13b74a503b35ce10e0868ebb0834a9a2696)
dc8c34
(cherry picked from commit e122758c186a8ae915ef28a769b2acdad33d7645)
dc8c34
---
dc8c34
 ldap/servers/plugins/replication/repl5_plugins.c | 87 ++++++++++++------------
dc8c34
 1 file changed, 44 insertions(+), 43 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c
dc8c34
index d49a666..7127395 100644
dc8c34
--- a/ldap/servers/plugins/replication/repl5_plugins.c
dc8c34
+++ b/ldap/servers/plugins/replication/repl5_plugins.c
dc8c34
@@ -1233,54 +1233,55 @@ process_postop (Slapi_PBlock *pb)
dc8c34
 			slapi_pblock_get( pb, SLAPI_OPERATION_PARAMETERS, &op_params );
dc8c34
 			slapi_ch_free((void **) &op_params->p.p_modrdn.modrdn_newsuperior_address.uniqueid);
dc8c34
 		}
dc8c34
-	}
dc8c34
-	if (!ignore_error_and_keep_going(retval)){
dc8c34
-		/*
dc8c34
-		 * We have an error we can't ignore.  Release the replica and close
dc8c34
-		 * the connection to stop the replication session.
dc8c34
-		 */
dc8c34
-		consumer_connection_extension *connext = NULL;
dc8c34
-		Slapi_Connection *conn = NULL;
dc8c34
-		char csn_str[CSN_STRSIZE] = {'\0'};
dc8c34
-		PRUint64 connid = 0;
dc8c34
-		int opid = 0;
dc8c34
 
dc8c34
-		slapi_pblock_get(pb, SLAPI_CONNECTION, &conn;;
dc8c34
-		slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
dc8c34
-		slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
dc8c34
-		if (conn)
dc8c34
-		{
dc8c34
-			slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
dc8c34
-				"process_postop: Failed to apply update (%s) error (%d).  "
dc8c34
-				"Aborting replication session(conn=%" NSPRIu64 " op=%d)\n",
dc8c34
-				csn_as_string(opcsn, PR_FALSE, csn_str), retval,
dc8c34
-				(long long unsigned int)connid, opid);
dc8c34
+		if (!ignore_error_and_keep_going(retval)){
dc8c34
 			/*
dc8c34
-			 * Release this replica so new sessions can begin
dc8c34
+			 * We have an error we can't ignore.  Release the replica and close
dc8c34
+			 * the connection to stop the replication session.
dc8c34
 			 */
dc8c34
-			connext = consumer_connection_extension_acquire_exclusive_access(conn, connid, opid);
dc8c34
-			if (connext && connext->replica_acquired)
dc8c34
+			consumer_connection_extension *connext = NULL;
dc8c34
+			Slapi_Connection *conn = NULL;
dc8c34
+			char csn_str[CSN_STRSIZE] = {'\0'};
dc8c34
+			PRUint64 connid = 0;
dc8c34
+			int opid = 0;
dc8c34
+
dc8c34
+			slapi_pblock_get(pb, SLAPI_CONNECTION, &conn;;
dc8c34
+			slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
dc8c34
+			slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
dc8c34
+			if (conn)
dc8c34
 			{
dc8c34
-				int zero = 0;
dc8c34
-				Replica *r = (Replica*)object_get_data ((Object*)connext->replica_acquired);
dc8c34
-
dc8c34
-				replica_relinquish_exclusive_access(r, connid, opid);
dc8c34
-				object_release ((Object*)connext->replica_acquired);
dc8c34
-				connext->replica_acquired = NULL;
dc8c34
-				connext->isreplicationsession = 0;
dc8c34
-				slapi_pblock_set( pb, SLAPI_CONN_IS_REPLICATION_SESSION, &zero );
dc8c34
-			}
dc8c34
-			if (connext){
dc8c34
-				consumer_connection_extension_relinquish_exclusive_access(conn, connid, opid, PR_FALSE);
dc8c34
-			}
dc8c34
+				slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
dc8c34
+					"process_postop: Failed to apply update (%s) error (%d).  "
dc8c34
+					"Aborting replication session(conn=%" NSPRIu64 " op=%d)\n",
dc8c34
+					csn_as_string(opcsn, PR_FALSE, csn_str), retval,
dc8c34
+					connid, opid);
dc8c34
+				/*
dc8c34
+				 * Release this replica so new sessions can begin
dc8c34
+				 */
dc8c34
+				connext = consumer_connection_extension_acquire_exclusive_access(conn, connid, opid);
dc8c34
+				if (connext && connext->replica_acquired)
dc8c34
+				{
dc8c34
+					int zero = 0;
dc8c34
+					Replica *r = (Replica*)object_get_data ((Object*)connext->replica_acquired);
dc8c34
+
dc8c34
+					replica_relinquish_exclusive_access(r, connid, opid);
dc8c34
+					object_release ((Object*)connext->replica_acquired);
dc8c34
+					connext->replica_acquired = NULL;
dc8c34
+					connext->isreplicationsession = 0;
dc8c34
+					slapi_pblock_set( pb, SLAPI_CONN_IS_REPLICATION_SESSION, &zero );
dc8c34
+				}
dc8c34
+				if (connext){
dc8c34
+					consumer_connection_extension_relinquish_exclusive_access(conn, connid, opid, PR_FALSE);
dc8c34
+				}
dc8c34
 
dc8c34
-			/*
dc8c34
-			 * Close the connection to end the current session with the
dc8c34
-			 * supplier.  This prevents new updates from coming in and
dc8c34
-			 * updating the consumer RUV - which would cause this failed
dc8c34
-			 * update to be never be replayed.
dc8c34
-			 */
dc8c34
-			slapi_disconnect_server(conn);
dc8c34
+				/*
dc8c34
+				 * Close the connection to end the current session with the
dc8c34
+				 * supplier.  This prevents new updates from coming in and
dc8c34
+				 * updating the consumer RUV - which would cause this failed
dc8c34
+				 * update to be never be replayed.
dc8c34
+				 */
dc8c34
+				slapi_disconnect_server(conn);
dc8c34
+			}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (NULL == opcsn)
dc8c34
-- 
dc8c34
2.4.3
dc8c34