Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4549/ldap/servers/plugins/replication
Modified Files:
Tag: Directory_Server_8_0_Branch
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.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- repl5_inc_protocol.c 18 Oct 2007 00:08:31 -0000 1.11
+++ repl5_inc_protocol.c 10 Jul 2008 23:18:04 -0000 1.11.2.1
@@ -294,6 +294,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)
{
@@ -328,6 +329,7 @@
}
if (conres != CONN_TIMEOUT)
{
+ int should_finish = 0;
if (message_id)
{
rd->last_message_id_received = message_id;
@@ -344,16 +346,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 ? */