]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9720 Import missing minCSNs from inside DB
authorOndřej Kuzník <ondra@mistotebe.net>
Thu, 21 Oct 2021 11:10:26 +0000 (12:10 +0100)
committerOndřej Kuzník <ondra@mistotebe.net>
Thu, 21 Oct 2021 11:10:34 +0000 (12:10 +0100)
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

index a68f3a9021ed665c78daad554ab1189a9ce73384..6c9825dd3a9e14dc63d9833355625f3d39cd0b2a 100644 (file)
@@ -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 );
        }