From dbc4a24898a073990e14fed3f1da25daa1091110 Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: Apr 05 2018 06:58:22 +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 Reviewed by: Mark, thanks --- diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c index 4ac45ac..3afc917 100644 --- a/ldap/servers/slapd/csngen.c +++ b/ldap/servers/slapd/csngen.c @@ -338,7 +338,11 @@ 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",