Commit eb5f1386 authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

ITS#9043 Only print sessionlog entries we think will apply

parent fdbeb69f
...@@ -1953,7 +1953,7 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs, ...@@ -1953,7 +1953,7 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs,
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info; slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private; syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
sessionlog *sl = si->si_logs; sessionlog *sl = si->si_logs;
int i, j, ndel, num, nmods, mmods, do_play = 0, rc = -1, *sidchks; int i, j, ndel, num, nmods, mmods, do_play = 0, rc = -1;
BerVarray uuids, csns; BerVarray uuids, csns;
struct berval uuid[2] = {}, csn[2] = {}; struct berval uuid[2] = {}, csn[2] = {};
slog_entry *se; slog_entry *se;
...@@ -1998,8 +1998,6 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs, ...@@ -1998,8 +1998,6 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs,
sl->sl_playing++; sl->sl_playing++;
ldap_pvt_thread_mutex_unlock( &sl->sl_mutex ); ldap_pvt_thread_mutex_unlock( &sl->sl_mutex );
sidchks = op->o_tmpcalloc( srs->sr_state.numcsns + 1, sizeof( int ),
op->o_tmpmemctx );
uuids = op->o_tmpalloc( (num) * sizeof( struct berval ) + uuids = op->o_tmpalloc( (num) * sizeof( struct berval ) +
num * UUID_LEN, op->o_tmpmemctx ); num * UUID_LEN, op->o_tmpmemctx );
uuids[0].bv_val = (char *)(uuids + num); uuids[0].bv_val = (char *)(uuids + num);
...@@ -2020,35 +2018,12 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs, ...@@ -2020,35 +2018,12 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs,
for ( k=0; k<srs->sr_state.numcsns; k++ ) { for ( k=0; k<srs->sr_state.numcsns; k++ ) {
if ( se->se_sid == srs->sr_state.sids[k] ) { if ( se->se_sid == srs->sr_state.sids[k] ) {
ndel = ber_bvcmp( &se->se_csn, &srs->sr_state.ctxcsn[k] ); ndel = ber_bvcmp( &se->se_csn, &srs->sr_state.ctxcsn[k] );
if ( !sidchks[k] || ndel > 0 ) {
if ( LogTest( LDAP_DEBUG_SYNC ) ) {
if ( !sidchks[k] ) {
Debug( LDAP_DEBUG_SYNC, "%s syncprov_play_sessionlog: "
"sync control csn %s\n",
op->o_log_prefix, srs->sr_state.ctxcsn[k].bv_val );
}
if ( !BER_BVISEMPTY( &se->se_uuid ) ) {
lutil_uuidstr_from_normalized( se->se_uuid.bv_val, se->se_uuid.bv_len,
uuidstr, 40 );
}
Debug( LDAP_DEBUG_SYNC, "%s syncprov_play_sessionlog: "
"log entry tag=%lu uuid=%s cookie=%s\n",
op->o_log_prefix, se->se_tag, uuidstr, se->se_csn.bv_val );
}
}
break; break;
} }
} }
if ( ndel <= 0 ) { if ( ndel <= 0 ) {
if ( !sidchks[k] ) {
Debug( LDAP_DEBUG_SYNC, "%s syncprov_play_sessionlog: "
"cmp %d, csn %s too old, skipping\n",
op->o_log_prefix, ndel, se->se_csn.bv_val );
sidchks[k] = 1;
}
continue; continue;
} }
sidchks[k] = 1;
ndel = 0; ndel = 0;
for ( k=0; k<numcsns; k++ ) { for ( k=0; k<numcsns; k++ ) {
if ( se->se_sid == sids[k] ) { if ( se->se_sid == sids[k] ) {
...@@ -2092,8 +2067,6 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs, ...@@ -2092,8 +2067,6 @@ syncprov_play_sessionlog( Operation *op, SlapReply *rs, sync_control *srs,
sl->sl_playing--; sl->sl_playing--;
ldap_pvt_thread_mutex_unlock( &sl->sl_mutex ); ldap_pvt_thread_mutex_unlock( &sl->sl_mutex );
op->o_tmpfree( sidchks, op->o_tmpmemctx );
ndel = i; ndel = i;
/* Zero out unused slots */ /* Zero out unused slots */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment