andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

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

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