Blame SOURCES/0076-Ticket-49631-same-csn-generated-twice.patch

b045b9
From 9c929dbfcd1687ba43b2b2ee649c0e6522365fad Mon Sep 17 00:00:00 2001
b045b9
From: Ludwig Krispenz <lkrispen@redhat.com>
b045b9
Date: Wed, 4 Apr 2018 08:59:15 +0200
b045b9
Subject: [PATCH] Ticket 49631 - same csn generated twice
b045b9
b045b9
Bug: if in the csn adjustment the local time was less or equal than the remote time
b045b9
     the sequence number has always been adjusted to remote++
b045b9
     but if the csn time was equal and the local seq number was larger the effect
b045b9
     was a reset of the csn generato.
b045b9
b045b9
Fix: correctly handles seqnum in csn adjustment
b045b9
b045b9
Reviewed by: Mark, thanks
b045b9
---
b045b9
 ldap/servers/slapd/csngen.c | 6 +++++-
b045b9
 1 file changed, 5 insertions(+), 1 deletion(-)
b045b9
b045b9
diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c
b045b9
index 4ac45acf0..3afc9176b 100644
b045b9
--- a/ldap/servers/slapd/csngen.c
b045b9
+++ b/ldap/servers/slapd/csngen.c
b045b9
@@ -338,7 +338,11 @@ csngen_adjust_time(CSNGen *gen, const CSN *csn)
b045b9
                we have increased the time, we can decrease the seqnum
b045b9
                and still guarantee that any new CSNs generated will be
b045b9
                > any current CSNs we have generated */
b045b9
-            gen->state.seq_num = remote_seqnum + 1;
b045b9
+            if (remote_seqnum < gen->state.seq_num) {
b045b9
+                gen->state.seq_num ++;
b045b9
+            } else {
b045b9
+                gen->state.seq_num = remote_seqnum + 1;
b045b9
+            }
b045b9
         }
b045b9
         if (slapi_is_loglevel_set(SLAPI_LOG_REPL)) {
b045b9
             slapi_log_err(SLAPI_LOG_REPL, "csngen_adjust_time",
b045b9
-- 
b045b9
2.13.6
b045b9