[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5_inc_protocol.c, 1.8, 1.8.2.1

Nathan Kinder (nkinder) fedora-directory-commits at redhat.com
Wed Jul 9 17:27:20 UTC 2008


Author: nkinder

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12621/plugins/replication

Modified Files:
      Tag: Directory71RtmBranch
	repl5_inc_protocol.c 
Log Message:
Resolves: 450973
Summary: Don't immediately exit in repl async thread when the consumer encounters an error.



Index: repl5_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_inc_protocol.c,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- repl5_inc_protocol.c	4 May 2005 23:58:51 -0000	1.8
+++ repl5_inc_protocol.c	9 Jul 2008 17:27:18 -0000	1.8.2.1
@@ -288,6 +288,7 @@
 		while (!finished)
 		{
 			conres = conn_read_result_ex(conn, NULL, NULL, NULL, &message_id, 0);
+			slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: read result for message_id %d\n", message_id);
 			/* Timeout here means that we didn't block, not a real timeout */
 			if (CONN_TIMEOUT == conres)
 			{
@@ -322,6 +323,7 @@
 		}
 		if (conres != CONN_TIMEOUT)
 		{
+			int should_finish = 0;
 			if (message_id) 
 			{
 				rd->last_message_id_received = message_id;
@@ -338,16 +340,18 @@
 			}
 
 			conn_get_error_ex(conn, &operation_code, &connection_error, &ldap_error_string);
-			slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: result %d, %d, %d, %s\n", operation_code,connection_error,conres,ldap_error_string);
-			rd->result = repl5_inc_update_from_op_result(rd->prp, conres, connection_error, csn_str, uniqueid, replica_id, &finished, &(rd->num_changes_sent));
-			if (rd->result)
+			slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: result %d, %d, %d, %d, %s\n", operation_code,connection_error,conres,message_id,ldap_error_string);
+			rd->result = repl5_inc_update_from_op_result(rd->prp, conres, connection_error, csn_str, uniqueid, replica_id, &should_finish, &(rd->num_changes_sent));
+			if (rd->result || should_finish)
 			{
-				slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: got op result %d\n", rd->result);
+				slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: got op result %d should finish %d\n", rd->result, should_finish);
 				/* If so then we need to take steps to abort the update process */
 				PR_Lock(rd->lock);
 				rd->abort = 1;
 				PR_Unlock(rd->lock);
 				/* We also need to log the error, including details stored from when the operation was sent */
+				/* we cannot finish yet - we still need to waitfor the pending results, then
+				 * the main repl code will shut down this thread */
 			}
 		}
 		/* Should we stop ? */




More information about the Fedora-directory-commits mailing list