/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003-2017 The OpenLDAP Foundation.
+ * Copyright 2003-2018 The OpenLDAP Foundation.
* Portions Copyright 2003 by IBM Corporation.
* Portions Copyright 2003-2008 by Howard Chu, Symas Corporation.
* All rights reserved.
struct berval *cookieCSN );
static int syncrepl_updateCookie(
syncinfo_t *, Operation *,
- struct sync_cookie * );
+ struct sync_cookie *, int save );
static struct berval * slap_uuidstr_from_normalized(
struct berval *, struct berval *, void * );
static int syncrepl_add_glue_ancestors(
if ( ( rc = syncrepl_message_to_op( si, op, msg ) ) == LDAP_SUCCESS &&
syncCookie.ctxcsn )
{
- rc = syncrepl_updateCookie( si, op, &syncCookie );
+ rc = syncrepl_updateCookie( si, op, &syncCookie, 0 );
} else switch ( rc ) {
case LDAP_ALREADY_EXISTS:
case LDAP_NO_SUCH_OBJECT:
syncstate, syncUUID, syncCookie.ctxcsn ) ) == LDAP_SUCCESS &&
syncCookie.ctxcsn )
{
- rc = syncrepl_updateCookie( si, op, &syncCookie );
+ rc = syncrepl_updateCookie( si, op, &syncCookie, 0 );
}
}
if ( punlock >= 0 ) {
}
if ( syncCookie.ctxcsn && match < 0 && err == LDAP_SUCCESS )
{
- rc = syncrepl_updateCookie( si, op, &syncCookie );
+ rc = syncrepl_updateCookie( si, op, &syncCookie, 1 );
}
if ( si->si_refreshCount ) {
LDAP_SLIST_REMOVE( &op->o_extra, si->si_refreshTxn, OpExtra, oe_next );
if ( syncCookie.ctxcsn )
{
- rc = syncrepl_updateCookie( si, op, &syncCookie);
+ rc = syncrepl_updateCookie( si, op, &syncCookie, 1 );
}
if ( si->si_presentlist ) {
presentlist_free( si->si_presentlist );
syncrepl_updateCookie(
syncinfo_t *si,
Operation *op,
- struct sync_cookie *syncCookie )
+ struct sync_cookie *syncCookie,
+ int save )
{
Backend *be = op->o_bd;
Modifications mod;
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;
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 )