]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/syncrepl.c
More syncprov fixes. test019 now passes.
[openldap] / servers / slapd / syncrepl.c
index 5d2fdcf40def0af98ccbf7a81d49d7f9d9b7d6ad..25a09460621b939b6e7909a3a123a3dae2866610 100644 (file)
@@ -613,7 +613,7 @@ do_syncrep2(
                                if ( syncrepl_message_to_entry( si, op, msg,
                                        &modlist, &entry, syncstate ) == LDAP_SUCCESS ) {
                                        rc_efree = syncrepl_entry( si, op, entry, modlist,
-                                               syncstate, &syncUUID, &syncCookie_req );
+                                               syncstate, &syncUUID, &syncCookie_req, syncCookie.ctxcsn );
                                        if ( syncCookie.octet_str &&
                                                !BER_BVISNULL( &syncCookie.octet_str[0] ) )
                                        {
@@ -890,6 +890,7 @@ do_syncrepl(
        syncinfo_t *si = ( syncinfo_t * ) rtask->arg;
        Connection conn = {0};
        Operation op = {0};
+       Opheader ohdr = {0};
        int rc = LDAP_SUCCESS;
        int first = 0;
        int dostop = 0;
@@ -918,7 +919,7 @@ do_syncrepl(
                return NULL;
        }
 
-       connection_fake_init( &conn, &op, ctx );
+       connection_fake_init( &conn, &op, &ohdr, ctx );
 
        /* use global malloc for now */
        op.o_tmpmemctx = NULL;
@@ -926,16 +927,9 @@ do_syncrepl(
 
        op.o_dn = si->si_updatedn;
        op.o_ndn = si->si_updatedn;
-       op.o_managedsait = 1;
+       op.o_managedsait = SLAP_CONTROL_NONCRITICAL;
        op.o_bd = be = si->si_be;
 
-       op.o_sync_state.ctxcsn = NULL;
-       op.o_sync_state.sid = -1;
-       op.o_sync_state.octet_str = NULL;
-       op.o_sync_slog_size = -1;
-       LDAP_STAILQ_FIRST( &op.o_sync_slog_list ) = NULL;
-       op.o_sync_slog_list.stqh_last = &LDAP_STAILQ_FIRST(&op.o_sync_slog_list);
-
        /* Establish session, do search */
        if ( !si->si_ld ) {
                first = 1;
@@ -1168,7 +1162,8 @@ syncrepl_entry(
        Modifications* modlist,
        int syncstate,
        struct berval* syncUUID,
-       struct sync_cookie* syncCookie_req )
+       struct sync_cookie* syncCookie_req,
+       struct berval* syncCSN )
 {
        Backend *be = op->o_bd;
        slap_callback   cb = { NULL };
@@ -1298,6 +1293,7 @@ syncrepl_entry(
        if ( rs_search.sr_err == LDAP_SUCCESS &&
                 !BER_BVISNULL( &si->si_syncUUID_ndn ))
        {
+#if 0
                char *subseq_ptr;
 
                if ( syncstate != LDAP_SYNC_DELETE ) {
@@ -1310,6 +1306,7 @@ syncrepl_entry(
                        subseq_ptr += 4;
                        *subseq_ptr = '1';
                }
+#endif
                
                op->o_req_dn = si->si_syncUUID_ndn;
                op->o_req_ndn = si->si_syncUUID_ndn;
@@ -1326,7 +1323,7 @@ syncrepl_entry(
                org_managedsait = get_manageDSAit( op );
                op->o_dn = op->o_bd->be_rootdn;
                op->o_ndn = op->o_bd->be_rootndn;
-               op->o_managedsait = 1;
+               op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
 
                while ( rs_delete.sr_err == LDAP_SUCCESS && op->o_delete_glue_parent ) {
                        op->o_delete_glue_parent = 0;
@@ -1350,7 +1347,9 @@ syncrepl_entry(
                op->o_req_ndn = org_req_ndn;
                op->o_delete_glue_parent = 0;
 
+#if 0
                op->o_no_psearch = 0;
+#endif
        }
 
        switch ( syncstate ) {
@@ -1449,7 +1448,6 @@ syncrepl_entry(
        }
 
 done :
-
        if ( !BER_BVISNULL( &syncUUID_strrep ) ) {
                slap_sl_free( syncUUID_strrep.bv_val, op->o_tmpmemctx );
                BER_BVZERO( &syncUUID_strrep );
@@ -1517,13 +1515,13 @@ syncrepl_del_nonpresent(
        op->ors_filterstr = si->si_filterstr;
 
        op->o_nocaching = 1;
-       op->o_managedsait = 0;
+       op->o_managedsait = SLAP_CONTROL_NONE;
 
        if ( limits_check( op, &rs_search ) == 0 ) {
                rc = be->be_search( op, &rs_search );
        }
 
-       op->o_managedsait = 1;
+       op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
        op->o_nocaching = 0;
 
        if ( op->ors_filter ) filter_free_x( op, op->ors_filter );
@@ -1578,7 +1576,7 @@ syncrepl_del_nonpresent(
                        org_managedsait = get_manageDSAit( op );
                        op->o_dn = op->o_bd->be_rootdn;
                        op->o_ndn = op->o_bd->be_rootndn;
-                       op->o_managedsait = 1;
+                       op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
 
                        while ( rs_delete.sr_err == LDAP_SUCCESS &&
                                        op->o_delete_glue_parent ) {
@@ -1887,6 +1885,8 @@ syncrepl_updateCookie(
        op->o_req_dn = e->e_name;
        op->o_req_ndn = e->e_nname;
 
+       slap_queue_csn( op, syncCookie->ctxcsn );
+
        /* update persistent cookie */
 update_cookie_retry:
        op->o_tag = LDAP_REQ_MODIFY;
@@ -1921,6 +1921,7 @@ update_cookie_retry:
                                "be_modify failed (%d)\n", rs_modify.sr_err, 0, 0 );
                }
        }
+       slap_graduate_commit_csn( op );
 
        if ( e != NULL ) {
                entry_free( e );