static int nonpresent_callback( struct slap_op *, struct slap_rep * );
static int null_callback( struct slap_op *, struct slap_rep * );
-static int si_refreshDelete = 0;
-static int si_refreshPresent = 0;
-
static AttributeDescription *sync_descs[4];
struct runqueue_s syncrepl_rq;
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] ) )
{
"do_syncrep2: %s - %s%s\n",
"LDAP_RES_INTERMEDIATE",
"REFRESH_DELETE\n", "\n" );
- si_refreshDelete = 1;
+ si->si_refreshDelete = 1;
case LDAP_TAG_SYNC_REFRESH_PRESENT:
Debug( LDAP_DEBUG_SYNC,
"do_syncrep2: %s - %s%s\n",
si_tag == LDAP_TAG_SYNC_REFRESH_PRESENT ?
"REFRESH_PRESENT" : "REFRESH_DELETE",
"\n" );
- si_refreshDelete = 1;
- si_refreshPresent = 1;
+ si->si_refreshDelete = 1;
+ si->si_refreshPresent = 1;
ber_scanf( ber, "t{" /*"}"*/, &tag );
if ( ber_peek_tag( ber, &len ) == LDAP_TAG_SYNC_COOKIE )
{
syncrepl_updateCookie( si, op, psub, &syncCookie);
}
- if ( si_refreshPresent == 1 ) {
+ if ( si->si_refreshPresent == 1 ) {
if ( match < 0 ) {
syncrepl_del_nonpresent( op, si );
}
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;
return NULL;
}
- connection_fake_init( &conn, &op, ctx );
+ connection_fake_init( &conn, &op, &ohdr, ctx );
/* use global malloc for now */
op.o_tmpmemctx = NULL;
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;
- si_refreshDelete = 0;
- si_refreshPresent = 0;
+ si->si_refreshDelete = 0;
+ si->si_refreshPresent = 0;
rc = do_syncrep1( &op, si );
}
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 };
struct berval org_ndn = BER_BVNULL;
int org_managedsait;
- Debug( LDAP_DEBUG_SYNC, "%s: %s",
- "syncrepl_entry",
- "LDAP_RES_SEARCH_ENTRY", 0 );
switch( syncstate ) {
case LDAP_SYNC_PRESENT:
- Debug( LDAP_DEBUG_SYNC, "%s: %s",
+ Debug( LDAP_DEBUG_SYNC, "%s: %s\n",
"syncrepl_entry",
- "LDAP_SYNC_PRESENT", "\n" );
+ "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_PRESENT)", 0 );
break;
case LDAP_SYNC_ADD:
- Debug( LDAP_DEBUG_SYNC, "%s: %s",
+ Debug( LDAP_DEBUG_SYNC, "%s: %s\n",
"syncrepl_entry",
- "LDAP_SYNC_ADD", "\n" );
+ "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_ADD)", 0 );
break;
case LDAP_SYNC_DELETE:
- Debug( LDAP_DEBUG_SYNC, "%s: %s",
+ Debug( LDAP_DEBUG_SYNC, "%s: %s\n",
"syncrepl_entry",
- "LDAP_SYNC_DELETE", "\n" );
+ "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_DELETE)", 0 );
break;
case LDAP_SYNC_MODIFY:
- Debug( LDAP_DEBUG_SYNC, "%s: %s",
+ Debug( LDAP_DEBUG_SYNC, "%s: %s\n",
"syncrepl_entry",
- "LDAP_SYNC_MODIFY", "\n" );
+ "LDAP_RES_SEARCH_ENTRY(LDAP_SYNC_MODIFY)", 0 );
break;
default:
- Debug( LDAP_DEBUG_ANY, "%s: %s",
+ Debug( LDAP_DEBUG_ANY, "%s: %s\n",
"syncrepl_entry",
- "UNKNONW syncstate", "\n" );
+ "LDAP_RES_SEARCH_ENTRY(UNKNOWN syncstate)", 0 );
}
if (( syncstate == LDAP_SYNC_PRESENT || syncstate == LDAP_SYNC_ADD )) {
- if ( !si_refreshPresent ) {
+ if ( !si->si_refreshPresent ) {
syncuuid_bv = ber_dupbv( NULL, syncUUID );
avl_insert( &si->si_presentlist, (caddr_t) syncuuid_bv,
syncuuid_cmp, avl_dup_error );
if ( rs_search.sr_err == LDAP_SUCCESS &&
!BER_BVISNULL( &si->si_syncUUID_ndn ))
{
+#if 0
char *subseq_ptr;
if ( syncstate != LDAP_SYNC_DELETE ) {
subseq_ptr += 4;
*subseq_ptr = '1';
}
+#endif
op->o_req_dn = si->si_syncUUID_ndn;
op->o_req_ndn = si->si_syncUUID_ndn;
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;
op->o_req_ndn = org_req_ndn;
op->o_delete_glue_parent = 0;
+#if 0
op->o_no_psearch = 0;
+#endif
}
switch ( syncstate ) {
}
done :
-
if ( !BER_BVISNULL( &syncUUID_strrep ) ) {
slap_sl_free( syncUUID_strrep.bv_val, op->o_tmpmemctx );
BER_BVZERO( &syncUUID_strrep );
Modifications *mlnext;
Modifications *mod;
Modifications *modlist = NULL;
- Modifications **modtail = &modlist;
+ Modifications **modtail;
AttributeName an[2];
struct berval pdn = BER_BVNULL;
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 );
rc = op->o_bd->be_delete( op, &rs_delete );
if ( rs_delete.sr_err == LDAP_NOT_ALLOWED_ON_NONLEAF ) {
+ modtail = &modlist;
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_desc = slap_schema.si_ad_objectClass;
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_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;
"be_modify failed (%d)\n", rs_modify.sr_err, 0, 0 );
}
}
+ slap_graduate_commit_csn( op );
if ( e != NULL ) {
entry_free( e );