]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/syncrepl.c
ITS#8789 revert previous patch
[openldap] / servers / slapd / syncrepl.c
index a0b87a9ec47be30a45b198d6b6ca3e487dd8044c..36d01d85bf7d69d759ed39abef7ac73497ae4324 100644 (file)
@@ -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;
-               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;
+       op->o_bd = si->si_wbe;
+       slap_queue_csn( op, &first );
 
-               mod.sml_numvals = sc.numcsns;
-               mod.sml_values = sc.ctxcsn;
+       op->o_tag = LDAP_REQ_MODIFY;
 
-               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 );
-               }
+       cb.sc_response = syncrepl_null_callback;
+       cb.sc_private = si;
 
-               op->orm_no_opattrs = 0;
-               op->o_dont_replicate = 0;
-       } else {
-               rc = 0;
+       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_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 );