From 99ba446fefa64bfc096c6484f6ca0869ae35465c Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: May 03 2018 14:24:42 +0000 Subject: Ticket 49631 - same csn generated twice Bug: if in the csn adjustment the local time was less or equal than the remote time the sequence number has always been adjusted to remote++ but if the csn time was equal and the local seq number was larger the effect was a reset of the csn generato. Fix: correctly handles seqnum in csn adjustment https://pagure.io/389-ds-base/issue/49631 Reviewed by: Mark, thanks --- diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c index 2c75c6d..da2d95d 100644 --- a/ldap/servers/slapd/csngen.c +++ b/ldap/servers/slapd/csngen.c @@ -375,7 +375,11 @@ int csngen_adjust_time(CSNGen *gen, const CSN* csn) we have increased the time, we can decrease the seqnum and still guarantee that any new CSNs generated will be > any current CSNs we have generated */ - gen->state.seq_num = remote_seqnum + 1; + if (remote_seqnum < gen->state.seq_num) { + gen->state.seq_num++; + } else { + gen->state.seq_num = remote_seqnum + 1; + } } if (slapi_is_loglevel_set(SLAPI_LOG_REPL)) { slapi_log_err(SLAPI_LOG_REPL, "csngen_adjust_time",