|
|
26521d |
From d56be1addb6f2a696f59e8971d0874a3e0d80ec7 Mon Sep 17 00:00:00 2001
|
|
|
26521d |
From: Ludwig Krispenz <lkrispen@redhat.com>
|
|
|
26521d |
Date: Wed, 20 Mar 2019 12:00:42 +0100
|
|
|
26521d |
Subject: [PATCH 4/4] Ticket 50265: the warning about skew time could last
|
|
|
26521d |
forever
|
|
|
26521d |
|
|
|
26521d |
Bug: if the local system time is set back more than 300 seconds
|
|
|
26521d |
a worning about too much time skew is logged and the sampled
|
|
|
26521d |
time is updated. This adjustment is done at every write operation
|
|
|
26521d |
and can increase the time skew and be logged infinitely
|
|
|
26521d |
|
|
|
26521d |
Fix: the intention of the adjustment was to avoid a roll over of seq_num
|
|
|
26521d |
if the sampled time is not increased for more than 65k oberations.
|
|
|
26521d |
But this is already handled with an explicite check for seq_num
|
|
|
26521d |
rollover. The extra adjustment for negative time skew can be removed.
|
|
|
26521d |
|
|
|
26521d |
Reviewed by: Thierry, William. Thanks.
|
|
|
26521d |
---
|
|
|
26521d |
ldap/servers/slapd/csngen.c | 22 +++++++---------------
|
|
|
26521d |
1 file changed, 7 insertions(+), 15 deletions(-)
|
|
|
26521d |
|
|
|
26521d |
diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c
|
|
|
26521d |
index 3afc9176b..68dbbda8e 100644
|
|
|
26521d |
--- a/ldap/servers/slapd/csngen.c
|
|
|
26521d |
+++ b/ldap/servers/slapd/csngen.c
|
|
|
26521d |
@@ -191,22 +191,14 @@ csngen_new_csn(CSNGen *gen, CSN **csn, PRBool notify)
|
|
|
26521d |
slapi_rwlock_unlock(gen->lock);
|
|
|
26521d |
return rc;
|
|
|
26521d |
}
|
|
|
26521d |
- } else if (delta < -300) {
|
|
|
26521d |
- /*
|
|
|
26521d |
- * The maxseqnum could support up to 65535 CSNs per second.
|
|
|
26521d |
- * That means that we could avoid duplicated CSN's for
|
|
|
26521d |
- * delta up to 300 secs if update rate is 200/sec (usually
|
|
|
26521d |
- * the max rate is below 20/sec).
|
|
|
26521d |
- * Beyond 300 secs, we advance gen->state.sampled_time by
|
|
|
26521d |
- * one sec to recycle seqnum.
|
|
|
26521d |
- */
|
|
|
26521d |
- slapi_log_err(SLAPI_LOG_WARNING, "csngen_new_csn", "Too much time skew (%d secs). Current seqnum=%0x\n", delta, gen->state.seq_num);
|
|
|
26521d |
- rc = _csngen_adjust_local_time(gen, gen->state.sampled_time + 1);
|
|
|
26521d |
- if (rc != CSN_SUCCESS) {
|
|
|
26521d |
- slapi_rwlock_unlock(gen->lock);
|
|
|
26521d |
- return rc;
|
|
|
26521d |
- }
|
|
|
26521d |
}
|
|
|
26521d |
+ /* if (delta < 0) this means the local system time was set back
|
|
|
26521d |
+ * the new csn will be generated based on sampled time, which is
|
|
|
26521d |
+ * ahead of system time and previously generated csns.
|
|
|
26521d |
+ * the time stamp of the csn will not change until system time
|
|
|
26521d |
+ * catches up or is corrected by remote csns.
|
|
|
26521d |
+ * But we need to ensure that the seq_num does not overflow.
|
|
|
26521d |
+ */
|
|
|
26521d |
|
|
|
26521d |
if (gen->state.seq_num == CSN_MAX_SEQNUM) {
|
|
|
26521d |
slapi_log_err(SLAPI_LOG_INFO, "csngen_new_csn", "Sequence rollover; "
|
|
|
26521d |
--
|
|
|
26521d |
2.17.2
|
|
|
26521d |
|