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) { ...@@ -1491,17 +1491,9 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
if ( lo->mask & LOG_OP_WRITES ) { if ( lo->mask & LOG_OP_WRITES ) {
slap_callback *cb; slap_callback *cb;
/* Most internal ops are not logged */ /* These internal ops are not logged */
if ( op->o_dont_replicate) { 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 )
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
}
ldap_pvt_thread_mutex_lock( &li->li_log_mutex ); ldap_pvt_thread_mutex_lock( &li->li_log_mutex );
old = li->li_old; old = li->li_old;
...@@ -1963,18 +1955,8 @@ accesslog_op_mod( Operation *op, SlapReply *rs ) ...@@ -1963,18 +1955,8 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
int doit = 0; int doit = 0;
/* These internal ops are not logged */ /* These internal ops are not logged */
if ( op->o_dont_replicate ) { 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 )
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
/* give this a unique timestamp */
op->o_tincr++;
}
logop = accesslog_op2logop( op ); logop = accesslog_op2logop( op );
lo = logops+logop+EN_OFFSET; lo = logops+logop+EN_OFFSET;
......
...@@ -1922,21 +1922,24 @@ syncprov_op_response( Operation *op, SlapReply *rs ) ...@@ -1922,21 +1922,24 @@ syncprov_op_response( Operation *op, SlapReply *rs )
} }
/* Don't do any processing for consumer contextCSN updates */ /* Don't do any processing for consumer contextCSN updates */
if ( op->o_dont_replicate ) { if ( SLAPD_SYNC_IS_SYNCCONN( op->o_connid ) &&
if ( op->o_tag == LDAP_REQ_MODIFY && op->o_tag == LDAP_REQ_MODIFY &&
op->orm_modlist->sml_op == LDAP_MOD_REPLACE && op->orm_modlist->sml_op == LDAP_MOD_REPLACE &&
op->orm_modlist->sml_desc == slap_schema.si_ad_contextCSN ) { op->orm_modlist->sml_desc == slap_schema.si_ad_contextCSN ) {
/* Catch contextCSN updates from syncrepl. We have to look at /* Catch contextCSN updates from syncrepl. We have to look at
* all the attribute values, as there may be more than one csn * all the attribute values, as there may be more than one csn
* that changed, and only one can be passed in the csn queue. * that changed, and only one can be passed in the csn queue.
*/ */
csn_changed = syncprov_new_ctxcsn( opc, si, csn_changed, csn_changed = syncprov_new_ctxcsn( opc, si, csn_changed,
op->orm_modlist->sml_numvals, op->orm_modlist->sml_values ); op->orm_modlist->sml_numvals, op->orm_modlist->sml_values );
} else { if ( csn_changed )
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock ); si->si_numops++;
} goto leave;
}
if ( op->o_dont_replicate ) {
if ( csn_changed ) if ( csn_changed )
si->si_numops++; si->si_numops++;
ldap_pvt_thread_rdwr_wunlock( &si->si_csn_rwlock );
goto leave; goto leave;
} }
......
...@@ -118,7 +118,6 @@ typedef struct syncinfo_s { ...@@ -118,7 +118,6 @@ typedef struct syncinfo_s {
int si_got; int si_got;
int si_strict_refresh; /* stop listening during fallback refresh */ int si_strict_refresh; /* stop listening during fallback refresh */
int si_too_old; int si_too_old;
int si_has_syncprov;
ber_int_t si_msgid; ber_int_t si_msgid;
Avlnode *si_presentlist; Avlnode *si_presentlist;
LDAP *si_ld; LDAP *si_ld;
...@@ -555,7 +554,6 @@ check_syncprov( ...@@ -555,7 +554,6 @@ check_syncprov(
ber_bvarray_free( a.a_nvals ); ber_bvarray_free( a.a_nvals );
} }
ber_bvarray_free( a.a_vals ); ber_bvarray_free( a.a_vals );
si->si_has_syncprov = 1;
} }
/* See if the cookieState has changed due to anything outside /* See if the cookieState has changed due to anything outside
* this particular consumer. That includes other consumers in * this particular consumer. That includes other consumers in
...@@ -720,8 +718,6 @@ do_syncrep1( ...@@ -720,8 +718,6 @@ do_syncrep1(
si->si_syncCookie.sids[i] = si->si_cookieState->cs_sids[i]; si->si_syncCookie.sids[i] = si->si_cookieState->cs_sids[i];
} }
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); 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 ); ch_free( si->si_syncCookie.octet_str.bv_val );
...@@ -3957,47 +3953,46 @@ syncrepl_updateCookie( ...@@ -3957,47 +3953,46 @@ syncrepl_updateCookie(
si->si_cookieState->cs_updating = 1; si->si_cookieState->cs_updating = 1;
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
if ( save || !si->si_has_syncprov ) { op->o_bd = si->si_wbe;
op->o_bd = si->si_wbe; slap_queue_csn( op, &first );
slap_queue_csn( op, &first );
op->o_tag = LDAP_REQ_MODIFY;
cb.sc_response = syncrepl_null_callback;
cb.sc_private = si;
op->o_callback = &cb;
op->o_req_dn = si->si_contextdn;
op->o_req_ndn = si->si_contextdn;
/* update contextCSN */
op->o_dont_replicate = 1;
mod.sml_numvals = sc.numcsns; op->o_tag = LDAP_REQ_MODIFY;
mod.sml_values = sc.ctxcsn;
op->orm_modlist = &mod; cb.sc_response = syncrepl_null_callback;
op->orm_no_opattrs = 1; cb.sc_private = si;
rc = op->o_bd->be_modify( op, &rs_modify );
if ( rs_modify.sr_err == LDAP_NO_SUCH_OBJECT &&
SLAP_SYNC_SUBENTRY( op->o_bd )) {
const char *text;
char txtbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof txtbuf;
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);
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_callback = &cb;
op->o_dont_replicate = 0; op->o_req_dn = si->si_contextdn;
} else { op->o_req_ndn = si->si_contextdn;
rc = 0;
/* update contextCSN */
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;
op->orm_modlist = &mod;
op->orm_no_opattrs = 1;
rc = op->o_bd->be_modify( op, &rs_modify );
if ( rs_modify.sr_err == LDAP_NO_SUCH_OBJECT &&
SLAP_SYNC_SUBENTRY( op->o_bd )) {
const char *text;
char txtbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof txtbuf;
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->orm_no_opattrs = 0;
...@@ -4040,8 +4035,7 @@ syncrepl_updateCookie( ...@@ -4040,8 +4035,7 @@ syncrepl_updateCookie(
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
op->o_bd = be; op->o_bd = be;
if ( op->o_csn.bv_val ) op->o_tmpfree( op->o_csn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->o_csn.bv_val, op->o_tmpmemctx );
BER_BVZERO( &op->o_csn ); BER_BVZERO( &op->o_csn );
if ( mod.sml_next ) slap_mods_free( mod.sml_next, 1 ); 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