mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Context CSN Patch (3)
- context csn management for delete - a later patch will take care of inconsistencies caused by interactions between outstanding search and scope-outs
This commit is contained in:
parent
3be0b77c88
commit
fbb8c9da5e
@ -37,6 +37,10 @@ bdb_delete( Operation *op, SlapReply *rs )
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
Operation* ps_list;
|
||||
int rc;
|
||||
EntryInfo *suffix_ei;
|
||||
Entry *ctxcsn_e;
|
||||
int ctxcsn_added = 0;
|
||||
#endif
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
@ -456,6 +460,16 @@ retry: /* transaction retry */
|
||||
ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei, &ctxcsn_e, &ctxcsn_added, locker );
|
||||
switch ( rc ) {
|
||||
case BDB_CSN_ABORT :
|
||||
goto return_results;
|
||||
case BDB_CSN_RETRY :
|
||||
goto retry;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( op->o_noop ) {
|
||||
if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) {
|
||||
rs->sr_text = "txn_abort (no-op) failed";
|
||||
@ -464,8 +478,21 @@ retry: /* transaction retry */
|
||||
rs->sr_err = LDAP_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
#ifdef LDAP_SYNC
|
||||
struct berval ctx_nrdn;
|
||||
#endif
|
||||
|
||||
bdb_cache_delete( &bdb->bi_cache, e, bdb->bi_dbenv,
|
||||
locker, &lock );
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ctxcsn_added ) {
|
||||
ctx_nrdn.bv_val = "cn=ldapsync";
|
||||
ctx_nrdn.bv_len = strlen( ctx_nrdn.bv_val );
|
||||
bdb_cache_add( bdb, suffix_ei, ctxcsn_e, &ctx_nrdn, locker );
|
||||
}
|
||||
#endif
|
||||
|
||||
rs->sr_err = TXN_COMMIT( ltid, 0 );
|
||||
}
|
||||
ltid = NULL;
|
||||
|
@ -25,6 +25,10 @@
|
||||
#include "ldap_pvt.h"
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
#include "lutil.h"
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SLAPI
|
||||
#include "slapi.h"
|
||||
#endif
|
||||
@ -198,6 +202,15 @@ do_delete(
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
|
||||
#endif
|
||||
{
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
if ( !repl_user ) {
|
||||
struct berval csn = { 0 , NULL };
|
||||
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
|
||||
slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (op->o_bd->be_delete)( op, rs ) == 0 ) {
|
||||
#ifdef SLAPD_MULTIMASTER
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
|
||||
@ -252,6 +265,11 @@ do_delete(
|
||||
#endif /* defined( LDAP_SLAPI ) */
|
||||
|
||||
cleanup:
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
slap_graduate_commit_csn( op );
|
||||
#endif
|
||||
|
||||
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
|
||||
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
|
||||
return rs->sr_err;
|
||||
|
Loading…
Reference in New Issue
Block a user