char buf[LDAP_LUTIL_CSNSTR_BUFSIZE + STRLENOF("(entryCSN<=)")];
char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
struct berval maxcsn;
- Filter cf, af;
+ Filter cf;
#ifdef LDAP_COMP_MATCH
AttributeAssertion eq = { NULL, BER_BVNULL, NULL };
#else
cb.sc_response = findcsn_cb;
break;
case FIND_PRESENT:
- af.f_choice = LDAP_FILTER_AND;
- af.f_next = NULL;
- af.f_and = &cf;
- cf.f_choice = LDAP_FILTER_LE;
- cf.f_av_value = srs->sr_state.ctxcsn;
- cf.f_next = op->ors_filter;
- fop.ors_filter = ⁡
- filter2bv_x( &fop, fop.ors_filter, &fop.ors_filterstr );
+ fop.ors_filter = op->ors_filter;
+ fop.ors_filterstr = op->ors_filterstr;
fop.ors_attrsonly = 0;
fop.ors_attrs = uuid_anlist;
fop.ors_slimit = SLAP_NO_LIMIT;
break;
case FIND_PRESENT:
op->o_tmpfree( pcookie.uuids, op->o_tmpmemctx );
- op->o_tmpfree( fop.ors_filterstr.bv_val, op->o_tmpmemctx );
break;
}
rs.sr_flags = REP_ENTRY_MUSTRELEASE;
if ( opc->sreference ) {
rs.sr_ref = get_entry_referrals( op, rs.sr_entry );
- send_search_reference( op, &rs );
+ rs.sr_err = send_search_reference( op, &rs );
ber_bvarray_free( rs.sr_ref );
if ( !rs.sr_entry )
*e = NULL;
if ( rs.sr_entry->e_private )
rs.sr_flags = REP_ENTRY_MUSTRELEASE;
rs.sr_attrs = op->ors_attrs;
- send_search_entry( op, &rs );
+ rs.sr_err = send_search_entry( op, &rs );
if ( !rs.sr_entry )
*e = NULL;
break;
if ( opc->sreference ) {
struct berval bv = BER_BVNULL;
rs.sr_ref = &bv;
- send_search_reference( op, &rs );
+ rs.sr_err = send_search_reference( op, &rs );
} else {
- send_search_entry( op, &rs );
+ rs.sr_err = send_search_entry( op, &rs );
}
break;
default:
if ( sr->s_mode != LDAP_SYNC_DELETE ) {
rc = be_entry_get_rw( op, &opc.sndn, NULL, NULL, 0, &e );
if ( rc ) {
+ Debug( LDAP_DEBUG_SYNC, "syncprov_qplay: failed to get %s, "
+ "error (%d), ignoring...\n", opc.sndn.bv_val, rc, 0 );
ch_free( sr );
+ rc = 0;
continue;
}
}
OperationBuffer opbuf;
Operation *op;
BackendDB be;
+ int rc;
op = (Operation *) &opbuf;
*op = *so->s_op;
op->o_private = NULL;
op->o_callback = NULL;
- (void)syncprov_qplay( op, on, so );
+ rc = syncprov_qplay( op, on, so );
/* decrement use count... */
syncprov_free_syncop( so );
/* wait until we get explicitly scheduled again */
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
- ldap_pvt_runqueue_stoptask( &slapd_rq, so->s_qtask );
- ldap_pvt_runqueue_resched( &slapd_rq, so->s_qtask, 1 );
+ ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
+ if ( rc == 0 ) {
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, 1 );
+ } else {
+ /* bail out on any error */
+ ldap_pvt_runqueue_remove( &slapd_rq, rtask );
+ }
ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
return NULL;
* and everything else at the end. Do this first so we can
* unlock the list mutex.
*/
+ Debug( LDAP_DEBUG_SYNC, "srs csn %s\n", srs-> sr_state.ctxcsn.bv_val, 0, 0 );
for ( se=sl->sl_head; se; se=se->se_next ) {
- if ( ber_bvcmp( &se->se_csn, &srs->sr_state.ctxcsn ) <= 0 ) continue;
- if ( ber_bvcmp( &se->se_csn, ctxcsn ) > 0 ) break;
+ Debug( LDAP_DEBUG_SYNC, "log csn %s\n", se-> se_csn.bv_val,
+0, 0 );
+ ndel = ber_bvcmp( &se->se_csn, &srs->sr_state.ctxcsn );
+ if ( ndel <= 0 ) {
+ Debug( LDAP_DEBUG_SYNC, "cmp %d, too old\n", ndel,
+0, 0 );
+ continue;
+ }
+ ndel = ber_bvcmp( &se->se_csn, ctxcsn );
+ if ( ndel > 0 ) {
+ Debug( LDAP_DEBUG_SYNC, "cmp %d, too new\n", ndel,
+0, 0 );
+ break;
+ }
if ( se->se_tag == LDAP_REQ_DELETE ) {
j = i;
i++;
switch ( c->type ) {
case SP_CHKPT:
if ( lutil_atoi( &si->si_chkops, c->argv[1] ) != 0 ) {
- sprintf( c->msg, "%s unable to parse checkpoint ops # \"%s\"",
+ snprintf( c->msg, sizeof( c->msg ), "%s unable to parse checkpoint ops # \"%s\"",
c->argv[0], c->argv[1] );
- Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s: %s\n", c->log, c->msg, 0 );
return ARG_BAD_CONF;
}
if ( si->si_chkops <= 0 ) {
- sprintf( c->msg, "%s invalid checkpoint ops # \"%d\"",
+ snprintf( c->msg, sizeof( c->msg ), "%s invalid checkpoint ops # \"%d\"",
c->argv[0], si->si_chkops );
- Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s: %s\n", c->log, c->msg, 0 );
return ARG_BAD_CONF;
}
if ( lutil_atoi( &si->si_chktime, c->argv[2] ) != 0 ) {
- sprintf( c->msg, "%s unable to parse checkpoint time \"%s\"",
+ snprintf( c->msg, sizeof( c->msg ), "%s unable to parse checkpoint time \"%s\"",
c->argv[0], c->argv[1] );
- Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s: %s\n", c->log, c->msg, 0 );
return ARG_BAD_CONF;
}
if ( si->si_chktime <= 0 ) {
- sprintf( c->msg, "%s invalid checkpoint time \"%d\"",
+ snprintf( c->msg, sizeof( c->msg ), "%s invalid checkpoint time \"%d\"",
c->argv[0], si->si_chkops );
- Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s: %s\n", c->log, c->msg, 0 );
return ARG_BAD_CONF;
}
si->si_chktime *= 60;
int size = c->value_int;
if ( size < 0 ) {
- sprintf( c->msg, "%s size %d is negative",
+ snprintf( c->msg, sizeof( c->msg ), "%s size %d is negative",
c->argv[0], size );
- Debug( LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s: %s\n", c->log, c->msg, 0 );
return ARG_BAD_CONF;
}
sl = si->si_logs;
out:
op->o_bd->bd_info = (BackendInfo *)on;
- ldap_pvt_thread_pool_context_reset( thrctx );
return 0;
}
op->o_dn = be->be_rootdn;
op->o_ndn = be->be_rootndn;
syncprov_checkpoint( op, &rs, on, &si->si_ctxcsn );
- ldap_pvt_thread_pool_context_reset( thrctx );
}
return 0;