mdb_entry_return( op, e );
moi = (mdb_op_info *)oex;
/* If it was setup by entry_get we should probably free it */
- if ( moi->moi_flag & MOI_FREEIT ) {
+ if (( moi->moi_flag & (MOI_FREEIT|MOI_KEEPER)) == MOI_FREEIT ) {
moi->moi_ref--;
if ( moi->moi_ref < 1 ) {
mdb_txn_reset( moi->moi_txn );
switch( txnop ) {
case SLAP_TXN_BEGIN:
- return mdb_opinfo_get( op, mdb, 0, moip );
+ rc = mdb_opinfo_get( op, mdb, 0, moip );
+ if ( !rc ) {
+ moi = *moip;
+ moi->moi_flag |= MOI_KEEPER;
+ }
+ return rc;
case SLAP_TXN_COMMIT:
rc = mdb_txn_commit( moi->moi_txn );
op->o_tmpfree( moi, op->o_tmpmemctx );
int si_refreshDelete;
int si_refreshPresent;
int si_refreshDone;
+ int si_refreshCount;
+ time_t si_refreshBeg;
+ time_t si_refreshEnd;
+ OpExtra *si_refreshTxn;
int si_syncdata;
int si_logstate;
int si_lazyCommit;
}
si->si_refreshDone = 0;
+ si->si_refreshBeg = slap_get_time();
+ si->si_refreshCount = 0;
+ si->si_refreshTxn = NULL;
+ Debug( LDAP_DEBUG_ANY, "do_syncrep1: %s starting refresh\n",
+ si->si_ridtxt, 0, 0 );
rc = ldap_sync_search( si, op->o_tmpmemctx );
{
si->si_refreshDone = 1;
}
+ if ( si->si_refreshDone ) {
+ if ( si->si_refreshCount ) {
+ LDAP_SLIST_REMOVE( &op->o_extra, si->si_refreshTxn, OpExtra, oe_next );
+ op->o_bd->bd_info->bi_op_txn( op, SLAP_TXN_COMMIT, &si->si_refreshTxn );
+ }
+ si->si_refreshEnd = slap_get_time();
+ Debug( LDAP_DEBUG_ANY, "do_syncrep1: %s finished refresh\n",
+ si->si_ridtxt, 0, 0 );
+ }
ber_scanf( ber, /*"{"*/ "}" );
if ( abs(si->si_type) == LDAP_SYNC_REFRESH_AND_PERSIST &&
si->si_refreshDone )
slap_queue_csn( op, syncCSN );
}
- if ( !si->si_refreshDone && si->si_lazyCommit )
- op->o_lazyCommit = SLAP_CONTROL_NONCRITICAL;
+ if ( !si->si_refreshDone ) {
+ if ( si->si_lazyCommit )
+ op->o_lazyCommit = SLAP_CONTROL_NONCRITICAL;
+ if ( si->si_refreshCount == 500 ) {
+ LDAP_SLIST_REMOVE( &op->o_extra, si->si_refreshTxn, OpExtra, oe_next );
+ op->o_bd->bd_info->bi_op_txn( op, SLAP_TXN_COMMIT, &si->si_refreshTxn );
+ si->si_refreshCount = 0;
+ si->si_refreshTxn = NULL;
+ }
+ if ( !si->si_refreshCount ) {
+ op->o_bd->bd_info->bi_op_txn( op, SLAP_TXN_BEGIN, &si->si_refreshTxn );
+ }
+ si->si_refreshCount++;
+ }
slap_op_time( &op->o_time, &op->o_tincr );
switch ( syncstate ) {