From 6ca85aa3a8f2898f785d3fe2fc0e129b18999d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Thu, 21 Oct 2021 12:10:26 +0100 Subject: [PATCH] ITS#9720 Import missing minCSNs from inside DB We might also ignore them, but if minCSN/contextCSN were not managed properly, might as well make the effort to approach the actual value at some point. --- servers/slapd/overlays/accesslog.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index a68f3a9021..6c9825dd3a 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -662,14 +662,16 @@ log_old_lookup( Operation *op, SlapReply *rs ) Debug( LDAP_DEBUG_ANY, "log_old_lookup: " "csn=%s with sid not in minCSN set!\n", a->a_nvals[0].bv_val ); - } - - /* Paranoid len check, normalized CSNs are always the same length */ - if ( len > li->li_mincsn[i].bv_len ) - len = li->li_mincsn[i].bv_len; - if ( ber_bvcmp( &li->li_mincsn[i], &a->a_nvals[0] ) < 0 ) { - pd->mincsn_updated = 1; - AC_MEMCPY( li->li_mincsn[i].bv_val, a->a_nvals[0].bv_val, len ); + slap_insert_csn_sids( (struct sync_cookie *)&li->li_mincsn, i, + sid, &a->a_nvals[0] ); + } else { + /* Paranoid len check, normalized CSNs are always the same length */ + if ( len > li->li_mincsn[i].bv_len ) + len = li->li_mincsn[i].bv_len; + if ( ber_bvcmp( &li->li_mincsn[i], &a->a_nvals[0] ) < 0 ) { + pd->mincsn_updated = 1; + AC_MEMCPY( li->li_mincsn[i].bv_val, a->a_nvals[0].bv_val, len ); + } } ldap_pvt_thread_mutex_unlock( &li->li_log_mutex ); }