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