mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 08:39:37 -05:00
ITS#8789 revert previous patch
And try another approach. Always write contextCSN updates, but don't set dont_replicate for updates we want propagated.
This commit is contained in:
parent
e0cc94a0b7
commit
08851a8200
3 changed files with 55 additions and 80 deletions
|
|
@ -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,22 +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++;
|
||||
if ( op->o_tincr >= 1000000 ) {
|
||||
op->o_tincr -= 1000000;
|
||||
op->o_time++;
|
||||
}
|
||||
}
|
||||
|
||||
logop = accesslog_op2logop( op );
|
||||
lo = logops+logop+EN_OFFSET;
|
||||
|
|
|
|||
|
|
@ -1934,23 +1934,26 @@ 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 &&
|
||||
op->orm_modlist->sml_op == LDAP_MOD_REPLACE &&
|
||||
op->orm_modlist->sml_desc == slap_schema.si_ad_contextCSN ) {
|
||||
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
|
||||
* all the attribute values, as there may be more than one csn
|
||||
* that changed, and only one can be passed in the csn queue.
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
csn_changed = syncprov_new_ctxcsn( opc, si, csn_changed,
|
||||
op->orm_modlist->sml_numvals, op->orm_modlist->sml_values );
|
||||
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;
|
||||
}
|
||||
|
||||
/* If we're adding the context entry, parse all of its contextCSNs */
|
||||
if ( op->o_tag == LDAP_REQ_ADD &&
|
||||
|
|
|
|||
|
|
@ -123,7 +123,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;
|
||||
|
|
@ -564,7 +563,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
|
||||
|
|
@ -729,8 +727,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 );
|
||||
|
|
@ -4028,47 +4024,46 @@ 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;
|
||||
op->o_bd = si->si_wbe;
|
||||
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 = !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_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;
|
||||
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);
|
||||
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->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;
|
||||
|
|
@ -4111,8 +4106,7 @@ 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 );
|
||||
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 );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue