Blame SOURCES/0070-Ticket-49619-adjustment-of-csn_generator-can-fail-so.patch

b045b9
From d606691d341dfffee0b02fc55fb29f74f975e775 Mon Sep 17 00:00:00 2001
b045b9
From: Thierry Bordaz <tbordaz@redhat.com>
b045b9
Date: Wed, 21 Mar 2018 18:26:16 +0100
b045b9
Subject: [PATCH] Ticket 49619 - adjustment of csn_generator can fail so next
b045b9
 generated csn can be equal to the most recent one received
b045b9
b045b9
Bug Description:
b045b9
	On consumer side csn_generator ajustment occurs (let CSN = highest known csn)
b045b9
b045b9
	    when a replication session starts
b045b9
	    when a csn is generated locally and than csn is <= CSN
b045b9
b045b9
	During adjustment, in the case
b045b9
b045b9
	    there is no remote/local offset (time change)
b045b9
	    the current_time on the consumer is identical to CSN
b045b9
b045b9
	Then next locally generated csn will only differ with seqnum
b045b9
b045b9
	The seqnum of the csn_generator is increased only if CSN.seqnum is larger
b045b9
	than the csn_generator one.
b045b9
	In case of egality, it remains unchanged.
b045b9
b045b9
	The consequence is that the next locally generated csn will be identical to CSN (except for the RID).
b045b9
	So even after csn_generator adjustment, csn_generator may create csn that are not larger than the CSN
b045b9
b045b9
Fix Description:
b045b9
	compare the new generated timestamp (time+offsets) with adjustment one.
b045b9
	If the new is greater or EQUAL, make sure the local seqnum is ahead the remote one
b045b9
b045b9
https://pagure.io/389-ds-base/issue/49619
b045b9
b045b9
Reviewed by: Mark Reynolds
b045b9
b045b9
Platforms tested: F27
b045b9
b045b9
Flag Day: no
b045b9
b045b9
Doc impact: no
b045b9
---
b045b9
 ldap/servers/slapd/csngen.c | 2 +-
b045b9
 1 file changed, 1 insertion(+), 1 deletion(-)
b045b9
b045b9
diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c
b045b9
index 287ea847e..4ac45acf0 100644
b045b9
--- a/ldap/servers/slapd/csngen.c
b045b9
+++ b/ldap/servers/slapd/csngen.c
b045b9
@@ -331,7 +331,7 @@ csngen_adjust_time(CSNGen *gen, const CSN *csn)
b045b9
         /* let's revisit the seq num - if the new time is > the old
b045b9
            tiem, we should reset the seq number to remote + 1 if
b045b9
            this won't cause a wrap around */
b045b9
-        if (new_time > cur_time) {
b045b9
+        if (new_time >= cur_time) {
b045b9
             /* just set seq_num regardless of whether the current one
b045b9
                is < or > than the remote one - the goal of this function
b045b9
                is to make sure we generate CSNs > the remote CSN - if
b045b9
-- 
b045b9
2.13.6
b045b9