Commit 20c77b4a authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#8789 revert previous patch

And try another approach. Always write contextCSN updates, but
don't set dont_replicate for updates we want propagated.
parent 8ab4308c
......@@ -1491,17 +1491,9 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
if ( lo->mask & LOG_OP_WRITES ) {
slap_callback *cb;
/* Most internal ops are not logged */
if ( op->o_dont_replicate) {
/* Let contextCSN updates from syncrepl thru; the underlying
* syncprov needs to see them. Skip others.
*/
if (( op->o_tag != LDAP_REQ_MODIFY ||
op->orm_modlist->sml_op != LDAP_MOD_REPLACE ||
op->orm_modlist->sml_desc != slap_schema.si_ad_contextCSN ) &&
op->orm_no_opattrs )
/* These internal ops are not logged */
if ( op->o_dont_replicate )
return SLAP_CB_CONTINUE;
}
ldap_pvt_thread_mutex_lock( &li->li_log_mutex );
old = li->li_old;
......@@ -1963,18 +1955,8 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
int doit = 0;
/* These internal ops are not logged */
if ( op->o_dont_replicate ) {
/* Let contextCSN updates from syncrepl thru; the underlying
* syncprov needs to see them. Skip others.
*/
if (( op->o_tag != LDAP_REQ_MODIFY ||
op->orm_modlist->sml_op != LDAP_MOD_REPLACE ||
op->orm_modlist->sml_desc != slap_schema.si_ad_contextCSN ) &&
op->orm_no_opattrs )
if ( op->o_dont_replicate )
return SLAP_CB_CONTINUE;
/* give this a unique timestamp */
op->o_tincr++;
}
logop = accesslog_op2logop( op );
lo = logops+logop+EN_OFFSET;
......
......@@ -1922,8 +1922,8 @@ syncprov_op_response( Operation *op, SlapReply *rs )
}
/* Don't do any processing for consumer contextCSN updates */
if ( op->o_dont_replicate ) {
if ( op->o_tag == LDAP_REQ_MODIFY &&
if ( SLAPD_SYNC_IS_SYNCCONN( op->o_connid ) &&
op->o_tag == LDAP_REQ_MODIFY &&
op->orm_modlist->sml_op == LDAP_MOD_REPLACE &&
op->orm_modlist->sml_desc == slap_schema.si_ad_contextCSN ) {
/* Catch contextCSN updates from syncrepl. We have to look at
......@@ -1932,11 +1932,14 @@ syncprov_op_response( Operation *op, SlapReply *rs )
*/
csn_changed = syncprov_new_ctxcsn( opc, si, csn_changed,
op->orm_modlist->sml_numvals, op->orm_modlist->sml_values );
} else {
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
if ( csn_changed )
si->si_numops++;
goto leave;
}
if ( op->o_dont_replicate ) {
if ( csn_changed )
si->si_numops++;
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
goto leave;
}
......
......@@ -118,7 +118,6 @@ typedef struct syncinfo_s {
int si_got;
int si_strict_refresh; /* stop listening during fallback refresh */
int si_too_old;
int si_has_syncprov;
ber_int_t si_msgid;
Avlnode *si_presentlist;
LDAP *si_ld;
......@@ -555,7 +554,6 @@ check_syncprov(
ber_bvarray_free( a.a_nvals );
}
ber_bvarray_free( a.a_vals );
si->si_has_syncprov = 1;
}
/* See if the cookieState has changed due to anything outside
* this particular consumer. That includes other consumers in
......@@ -720,8 +718,6 @@ do_syncrep1(
si->si_syncCookie.sids[i] = si->si_cookieState->cs_sids[i];
}
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
/* Also look in syncprov overlay, if it was already active */
check_syncprov( op, si );
}
ch_free( si->si_syncCookie.octet_str.bv_val );
......@@ -3957,7 +3953,6 @@ syncrepl_updateCookie(
si->si_cookieState->cs_updating = 1;
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
if ( save || !si->si_has_syncprov ) {
op->o_bd = si->si_wbe;
slap_queue_csn( op, &first );
......@@ -3971,7 +3966,11 @@ syncrepl_updateCookie(
op->o_req_ndn = si->si_contextdn;
/* update contextCSN */
op->o_dont_replicate = 1;
op->o_dont_replicate = !save;
/* avoid timestamp collisions */
if ( save )
slap_op_time( &op->o_time, &op->o_tincr );
mod.sml_numvals = sc.numcsns;
mod.sml_values = sc.ctxcsn;
......@@ -3988,18 +3987,14 @@ syncrepl_updateCookie(
Entry *e = slap_create_context_csn_entry( op->o_bd, NULL );
rs_reinit( &rs_modify, REP_RESULT );
rc = slap_mods2entry( &mod, &e, 0, 1, &text, txtbuf, textlen);
slap_queue_csn( op, &first );
op->o_tag = LDAP_REQ_ADD;
op->ora_e = e;
rc = op->o_bd->be_add( op, &rs_modify );
if ( e == op->ora_e )
be_entry_release_w( op, op->ora_e );
}
op->orm_no_opattrs = 0;
op->o_dont_replicate = 0;
} else {
rc = 0;
}
op->orm_no_opattrs = 0;
op->o_dont_replicate = 0;
ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
......@@ -4040,7 +4035,6 @@ syncrepl_updateCookie(
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
op->o_bd = be;
if ( op->o_csn.bv_val )
op->o_tmpfree( op->o_csn.bv_val, op->o_tmpmemctx );
BER_BVZERO( &op->o_csn );
if ( mod.sml_next ) slap_mods_free( mod.sml_next, 1 );
......
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