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

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