From 3167b29812c1eb7b6ec8aecde054d353340f3ba2 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 20 Nov 2005 10:39:05 +0000 Subject: [PATCH] Fix back-bdb inequality_candidates to use unchecked limit. Fix syncprov_findcsn to set unchecked limit. (ITS#3939) --- servers/slapd/back-bdb/filterindex.c | 5 ++--- servers/slapd/overlays/syncprov.c | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/servers/slapd/back-bdb/filterindex.c b/servers/slapd/back-bdb/filterindex.c index 21431fec2d..a1e124d614 100644 --- a/servers/slapd/back-bdb/filterindex.c +++ b/servers/slapd/back-bdb/filterindex.c @@ -978,7 +978,6 @@ inequality_candidates( { struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private; DB *db; - int i; int rc; slap_mask_t mask; struct berval prefix = {0, NULL}; @@ -1066,9 +1065,9 @@ inequality_candidates( bdb_idl_union( ids, tmp ); - if( BDB_IDL_IS_ZERO( ids ) ) + if( op->ors_limit && op->ors_limit->lms_s_unchecked != -1 && + BDB_IDL_N( ids ) >= (unsigned) op->ors_limit->lms_s_unchecked ) break; - i++; } ber_bvarray_free_x( keys, op->o_tmpmemctx ); diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 4e090b0fc9..68821da72f 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -583,10 +583,10 @@ syncprov_findcsn( Operation *op, find_csn_t mode ) #else AttributeAssertion eq = { NULL, BER_BVNULL }; #endif - int i, rc = LDAP_SUCCESS; fpres_cookie pcookie; sync_control *srs = NULL; - int findcsn_retry = 1; + struct slap_limits_set fc_limits; + int i, rc = LDAP_SUCCESS, findcsn_retry = 1; if ( mode != FIND_MAXCSN ) { srs = op->o_controls[slap_cids.sc_LDAPsync]; @@ -637,6 +637,8 @@ again: /* On retry, look for <= */ } else { cf.f_choice = LDAP_FILTER_LE; + fop.ors_limit = &fc_limits; + fc_limits.lms_s_unchecked = 1; fop.ors_filterstr.bv_len = sprintf( buf, "(entryCSN<=%s)", cf.f_av_value.bv_val ); } @@ -1244,7 +1246,9 @@ syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) opm.o_req_ndn = op->o_bd->be_nsuffix[0]; opm.o_bd->bd_info = on->on_info->oi_orig; opm.o_managedsait = SLAP_CONTROL_NONCRITICAL; + SLAP_DBFLAGS( opm.o_bd ) |= SLAP_DBFLAG_NOLASTMOD; opm.o_bd->be_modify( &opm, &rsm ); + SLAP_DBFLAGS( opm.o_bd ) ^= SLAP_DBFLAG_NOLASTMOD; if ( mod.sml_next != NULL ) { slap_mods_free( mod.sml_next, 1 ); } -- 2.39.5