amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone

Blame SOURCES/0097-Ticket-47788-Only-check-postop-result-if-its-a-repli.patch

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