Blame SOURCES/0082-Ticket-47516-replication-stops-with-excessive-clock-.patch

cc3dff
From 029e230581a4b8e955db01dd0735f1ad9db521ac Mon Sep 17 00:00:00 2001
cc3dff
From: Rich Megginson <rmeggins@redhat.com>
cc3dff
Date: Thu, 16 Jan 2014 12:57:22 -0700
cc3dff
Subject: [PATCH 82/83] Ticket #47516 replication stops with excessive clock
cc3dff
 skew
cc3dff
cc3dff
https://fedorahosted.org/389/ticket/47516
cc3dff
Reviewed by: nhosoi (Thanks!)
cc3dff
Branch: 389-ds-base-1.3.1
cc3dff
Fix Description: The previous fix was not adequate.  Instead, the determination
cc3dff
of whether or not to ignore time skew should be determined in
cc3dff
csngen_adjust_time().
cc3dff
Platforms tested: RHEL6 x86_64
cc3dff
Flag Day: no
cc3dff
Doc impact: yes - document new config param
cc3dff
(cherry picked from commit 9f2b104b0938b21d7c9fe37c736d0e6328843aeb)
cc3dff
(cherry picked from commit a6ec074c6295a59938f313b4fe09430e8f601fab)
cc3dff
(cherry picked from commit 51c1b2a0e4245b90f418f9f909c1d17c564f77f3)
cc3dff
---
cc3dff
 ldap/servers/plugins/replication/repl_extop.c | 11 ++---------
cc3dff
 ldap/servers/slapd/csngen.c                   |  8 ++++++--
cc3dff
 2 files changed, 8 insertions(+), 11 deletions(-)
cc3dff
cc3dff
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
cc3dff
index 57249a6..35014a9 100644
cc3dff
--- a/ldap/servers/plugins/replication/repl_extop.c
cc3dff
+++ b/ldap/servers/plugins/replication/repl_extop.c
cc3dff
@@ -835,19 +835,12 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
cc3dff
 				rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */
cc3dff
 				if (rc == CSN_LIMIT_EXCEEDED)
cc3dff
 				{
cc3dff
-					extern int config_get_ignore_time_skew();
cc3dff
-
cc3dff
 					slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
cc3dff
 									"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
cc3dff
 									"Excessive clock skew from supplier RUV\n",
cc3dff
 									(long long unsigned int)connid, opid, repl_root);
cc3dff
-					if (!config_get_ignore_time_skew()) {
cc3dff
-						response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
cc3dff
-						goto send_response;
cc3dff
-					} else {
cc3dff
-						/* else just continue */
cc3dff
-						rc = 0;
cc3dff
-					}
cc3dff
+					response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
cc3dff
+					goto send_response;
cc3dff
 				}
cc3dff
 				else if (rc != 0)
cc3dff
 				{
cc3dff
diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c
cc3dff
index 464a59e..f87f2d1 100644
cc3dff
--- a/ldap/servers/slapd/csngen.c
cc3dff
+++ b/ldap/servers/slapd/csngen.c
cc3dff
@@ -326,6 +326,8 @@ int csngen_adjust_time(CSNGen *gen, const CSN* csn)
cc3dff
     time_t remote_time, remote_offset, cur_time;
cc3dff
 	PRUint16 remote_seqnum;
cc3dff
     int rc;
cc3dff
+    extern int config_get_ignore_time_skew();
cc3dff
+    int ignore_time_skew = config_get_ignore_time_skew();
cc3dff
 
cc3dff
     if (gen == NULL || csn == NULL)
cc3dff
         return CSN_INVALID_PARAMETER;
cc3dff
@@ -380,7 +382,7 @@ int csngen_adjust_time(CSNGen *gen, const CSN* csn)
cc3dff
         remote_offset = remote_time - cur_time;
cc3dff
 		if (remote_offset > gen->state.remote_offset)
cc3dff
 		{
cc3dff
-			if (remote_offset <= CSN_MAX_TIME_ADJUST)
cc3dff
+			if (ignore_time_skew || (remote_offset <= CSN_MAX_TIME_ADJUST))
cc3dff
 			{
cc3dff
 	        	gen->state.remote_offset = remote_offset;
cc3dff
 			}
cc3dff
@@ -651,6 +653,8 @@ _csngen_cmp_callbacks (const void *el1, const void *el2)
cc3dff
 static int 
cc3dff
 _csngen_adjust_local_time (CSNGen *gen, time_t cur_time)
cc3dff
 {
cc3dff
+    extern int config_get_ignore_time_skew();
cc3dff
+    int ignore_time_skew = config_get_ignore_time_skew();
cc3dff
     time_t time_diff = cur_time - gen->state.sampled_time;
cc3dff
 
cc3dff
     if (time_diff == 0) {
cc3dff
@@ -714,7 +718,7 @@ _csngen_adjust_local_time (CSNGen *gen, time_t cur_time)
cc3dff
                              gen->state.remote_offset);
cc3dff
         }
cc3dff
 
cc3dff
-        if (abs (time_diff) > CSN_MAX_TIME_ADJUST)
cc3dff
+        if (!ignore_time_skew && (abs (time_diff) > CSN_MAX_TIME_ADJUST))
cc3dff
         {
cc3dff
             slapi_log_error (SLAPI_LOG_FATAL, NULL, "_csngen_adjust_local_time: "
cc3dff
                              "adjustment limit exceeded; value - %d, limit - %d\n",
cc3dff
-- 
cc3dff
1.8.1.4
cc3dff