]> git.sur5r.net Git - openldap/commitdiff
Fix back-bdb inequality_candidates to use unchecked limit.
authorHoward Chu <hyc@openldap.org>
Sun, 20 Nov 2005 10:39:05 +0000 (10:39 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 20 Nov 2005 10:39:05 +0000 (10:39 +0000)
Fix syncprov_findcsn to set unchecked limit. (ITS#3939)

servers/slapd/back-bdb/filterindex.c
servers/slapd/overlays/syncprov.c

index 21431fec2d01c30f60b661be9012198c9e0e42f9..a1e124d614cea1e5e08935b1815907d4efdce687 100644 (file)
@@ -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 );
 
index 4e090b0fc98f93e51b0bd09d54deb97726698e87..68821da72f738fa95de491c645e1d4ad4c5f0565 100644 (file)
@@ -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 );
        }