[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5.h, 1.10, 1.10.2.1 repl5_inc_protocol.c, 1.11.2.1, 1.11.2.2 repl5_replica.c, 1.16, 1.16.2.1 repl_extop.c, 1.12, 1.12.2.1 windows_inc_protocol.c, 1.15, 1.15.2.1
Nathan Kinder (nkinder)
fedora-directory-commits at redhat.com
Fri Jul 11 15:27:05 UTC 2008
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20221/ldap/servers/plugins/replication
Modified Files:
Tag: Directory_Server_8_0_Branch
repl5.h repl5_inc_protocol.c repl5_replica.c repl_extop.c
windows_inc_protocol.c
Log Message:
Resolves: 233642
Summary: MMR breaks with time skew errors
Index: repl5.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5.h,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- repl5.h 12 Sep 2007 23:05:24 -0000 1.10
+++ repl5.h 11 Jul 2008 15:27:02 -0000 1.10.2.1
@@ -486,6 +486,7 @@
void replica_get_referrals(const Replica *r, char ***referrals);
void replica_set_referrals(Replica *r,const Slapi_ValueSet *vs);
int replica_update_csngen_state (Replica *r, const RUV *ruv);
+int replica_update_csngen_state_ext (Replica *r, const RUV *ruv, const CSN *extracsn);
CSN *replica_get_purge_csn(const Replica *r);
int replica_log_ruv_elements (const Replica *r);
void replica_enumerate_replicas (FNEnumReplica fn, void *arg);
Index: repl5_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_inc_protocol.c,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -r1.11.2.1 -r1.11.2.2
--- repl5_inc_protocol.c 10 Jul 2008 23:18:04 -0000 1.11.2.1
+++ repl5_inc_protocol.c 11 Jul 2008 15:27:02 -0000 1.11.2.2
@@ -1100,13 +1100,20 @@
rc = replica_update_csngen_state (replica, ruv);
object_release (prp->replica_object);
replica = NULL;
- if (rc != 0) /* too much skew */
+ if (rc == CSN_LIMIT_EXCEEDED) /* too much skew */
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"%s: Incremental protocol: fatal error - too much time skew between replicas!\n",
agmt_get_long_name(prp->agmt));
next_state = STATE_STOP_FATAL_ERROR;
}
+ else if (rc != 0) /* internal error */
+ {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Incremental protocol: fatal internal error updating the CSN generator!\n",
+ agmt_get_long_name(prp->agmt));
+ next_state = STATE_STOP_FATAL_ERROR;
+ }
else
{
rc = send_updates(prp, ruv, &num_changes_sent);
Index: repl5_replica.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_replica.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -r1.16 -r1.16.2.1
--- repl5_replica.c 18 Oct 2007 22:40:17 -0000 1.16
+++ repl5_replica.c 11 Jul 2008 15:27:02 -0000 1.16.2.1
@@ -1043,7 +1043,7 @@
}
int
-replica_update_csngen_state (Replica *r, const RUV *ruv)
+replica_update_csngen_state_ext (Replica *r, const RUV *ruv, const CSN *extracsn)
{
int rc = 0;
CSNGen *gen;
@@ -1057,34 +1057,42 @@
return -1;
}
- if (csn == NULL) /* ruv contains no csn - we are done */
+ if ((csn == NULL) && (extracsn == NULL)) /* ruv contains no csn and no extra - we are done */
{
return 0;
}
+ if (csn_compare(extracsn, csn) > 0) /* extracsn > csn */
+ {
+ csn_free (&csn); /* free */
+ csn = (CSN*)extracsn; /* use this csn to do the update */
+ }
+
PR_Lock(r->repl_lock);
gen = (CSNGen *)object_get_data (r->repl_csngen);
PR_ASSERT (gen);
rc = csngen_adjust_time (gen, csn);
- if (rc != CSN_SUCCESS)
- {
- rc = -1;
- goto done;
- }
-
- rc = 0;
+ /* rc will be either CSN_SUCCESS (0) or clock skew */
done:
PR_Unlock(r->repl_lock);
- if (csn)
+ if (csn != extracsn) /* do not free the given csn */
+ {
csn_free (&csn);
+ }
return rc;
}
+int
+replica_update_csngen_state (Replica *r, const RUV *ruv)
+{
+ return replica_update_csngen_state_ext(r, ruv, NULL);
+}
+
/*
* dumps replica state for debugging purpose
*/
Index: repl_extop.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl_extop.c,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -r1.12 -r1.12.2.1
--- repl_extop.c 18 Oct 2007 00:08:31 -0000 1.12
+++ repl_extop.c 11 Jul 2008 15:27:02 -0000 1.12.2.1
@@ -550,7 +550,6 @@
Replica *replica = NULL;
void *conn;
consumer_connection_extension *connext = NULL;
- CSN *mycsn = NULL;
char *replicacsnstr = NULL;
CSN *replicacsn = NULL;
int zero = 0;
@@ -703,55 +702,37 @@
gen = object_get_data(gen_obj);
if (NULL != gen)
{
- if (csngen_new_csn(gen, &mycsn, PR_FALSE /* notify */) == CSN_SUCCESS)
+ replicacsn = csn_new_by_string(replicacsnstr);
+ if (NULL != replicacsn)
{
- replicacsn = csn_new_by_string(replicacsnstr);
- if (NULL != replicacsn)
+ /* ONREPL - we used to manage clock skew here. However, csn generator
+ code already does it. The csngen also manages local skew caused by
+ system clock reset, so to keep it consistent, I removed code from here */
+ /* update the state of the csn generator */
+ rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */
+ if (rc == CSN_LIMIT_EXCEEDED)
{
- /* ONREPL - we used to manage clock skew here. However, csn generator
- code already does it. The csngen also manages local skew caused by
- system clock reset, so to keep it consistent, I removed code from here */
- time_t diff = 0L;
- diff = csn_time_difference(mycsn, replicacsn);
- if (diff > 0)
- {
- /* update the state of the csn generator */
- rc = csngen_adjust_time (gen, replicacsn);
- if (rc == CSN_LIMIT_EXCEEDED) /* too much skew */
- {
- response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
- goto send_response;
- }
- }
- else if (diff <= 0)
- {
- /* Supplier's clock is behind ours */
- /* XXXggood check if CSN smaller than purge point */
- /* response = NSDS50_REPL_BELOW_PURGEPOINT; */
- /* goto send_response; */
- }
+ response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "conn=%d op=%d repl=\"%s\": "
+ "Excessive clock skew from supplier RUV\n",
+ connid, opid, repl_root);
+ goto send_response;
}
- else
+ else if (rc != 0)
{
- /* Oops, csnstr couldn't be converted */
+ /* Oops, problem csn or ruv format, or memory, or .... */
response = NSDS50_REPL_INTERNAL_ERROR;
goto send_response;
}
+
}
else
{
- /* Oops, csn generator failed */
+ /* Oops, csnstr couldn't be converted */
response = NSDS50_REPL_INTERNAL_ERROR;
goto send_response;
}
-
- /* update csn generator's state from the supplier's ruv */
- rc = replica_update_csngen_state (replica, supplier_ruv); /* too much skew */
- if (rc != 0)
- {
- response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
- goto send_response;
- }
}
else
{
@@ -988,11 +969,6 @@
{
object_release(gen_obj);
}
- /* mycsn */
- if (NULL != mycsn)
- {
- csn_free(&mycsn);
- }
/* replicacsn */
if (NULL != replicacsn)
{
Index: windows_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_inc_protocol.c,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- windows_inc_protocol.c 18 Oct 2007 00:08:31 -0000 1.15
+++ windows_inc_protocol.c 11 Jul 2008 15:27:02 -0000 1.15.2.1
@@ -796,13 +796,20 @@
rc = replica_update_csngen_state (replica, ruv);
object_release (prp->replica_object);
replica = NULL;
- if (rc != 0) /* too much skew */
+ if (rc == CSN_LIMIT_EXCEEDED) /* too much skew */
{
- slapi_log_error(SLAPI_LOG_FATAL, windows_repl_plugin_name,
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"%s: Incremental protocol: fatal error - too much time skew between replicas!\n",
agmt_get_long_name(prp->agmt));
next_state = STATE_STOP_FATAL_ERROR;
}
+ else if (rc != 0) /* internal error */
+ {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Incremental protocol: fatal internal error updating the CSN generator!\n",
+ agmt_get_long_name(prp->agmt));
+ next_state = STATE_STOP_FATAL_ERROR;
+ }
else
{
rc = send_updates(prp, ruv, &num_changes_sent);
More information about the Fedora-directory-commits
mailing list