Delete obsolete syncprovider stuff

This commit is contained in:
Howard Chu 2005-01-14 05:49:45 +00:00
parent 9f30e1e650
commit aa27cb2262
11 changed files with 26 additions and 1891 deletions

View File

@ -18,14 +18,14 @@ SRCS = init.c tools.c config.c \
extended.c referral.c operational.c \
attr.c index.c key.c dbcache.c filterindex.c \
dn2entry.c dn2id.c error.c id2entry.c idl.c \
nextid.c cache.c trans.c ctxcsn.c
nextid.c cache.c trans.c
OBJS = init.lo tools.lo config.lo \
add.lo bind.lo compare.lo delete.lo modify.lo modrdn.lo search.lo \
extended.lo referral.lo operational.lo \
attr.lo index.lo key.lo dbcache.lo filterindex.lo \
dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo \
nextid.lo cache.lo trans.lo ctxcsn.lo
nextid.lo cache.lo trans.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries

View File

@ -367,19 +367,6 @@ retry: /* transaction retry */
goto return_results;
}
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
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
/* post-read */
if( op->o_postread ) {
if( postread_ctrl == NULL ) {
@ -421,31 +408,6 @@ retry: /* transaction retry */
suffix_ei = BEI(e);
}
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
if ( ctxcsn_added ) {
bdb_cache_add( bdb, suffix_ei, ctxcsn_e,
(struct berval *)&slap_ldapsync_cn_bv, locker );
}
}
if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) {
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
assert( BEI(e) );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_ADD );
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_add)
": persistent search failed "
"(%d,%d)\n",
rc, rs->sr_err, 0 );
}
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
}
#endif
if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) {
rs->sr_text = "txn_commit failed";
} else {

View File

@ -23,8 +23,6 @@
LDAP_BEGIN_DECL
#undef BDB_PSEARCH
#define DB_VERSION_FULL ((DB_VERSION_MAJOR << 24) | (DB_VERSION_MINOR << 16) | DB_VERSION_PATCH)
#define BDB_SUBENTRIES 1
@ -184,11 +182,6 @@ struct bdb_info {
ID bi_lastid;
ldap_pvt_thread_mutex_t bi_lastid_mutex;
#ifdef BDB_PSEARCH
LDAP_LIST_HEAD(pl, slap_op) bi_psearch_list;
ldap_pvt_thread_rdwr_t bi_pslist_rwlock;
LDAP_LIST_HEAD(se, slap_session_entry) bi_session_list;
#endif
int bi_idl_cache_max_size;
int bi_idl_cache_size;
Avlnode *bi_idl_tree;

View File

@ -194,48 +194,7 @@ bdb_db_config(
}
if ( !( slapMode & SLAP_TOOL_MODE ) )
bdb->bi_idl_cache_max_size = atoi( argv[1] );
#ifdef BDB_PSEARCH
} else if ( strcasecmp( argv[0], "sessionlog" ) == 0 ) {
int se_id = 0, se_size = 0;
struct slap_session_entry *sent;
if ( argc < 3 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing arguments in \"sessionlog <id> <size>\""
" line\n", fname, lineno, 0 );
return( 1 );
}
se_id = atoi( argv[1] );
if ( se_id < 0 || se_id > 999 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: session log id %d is out of range [0..999]\n",
fname, lineno , se_id );
return( 1 );
}
se_size = atoi( argv[2] );
if ( se_size < 0 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: session log size %d is negative\n",
fname, lineno , se_size );
return( 1 );
}
LDAP_LIST_FOREACH( sent, &bdb->bi_session_list, se_link ) {
if ( sent->se_id == se_id ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: session %d already exists\n",
fname, lineno , se_id );
return( 1 );
}
}
sent = (struct slap_session_entry *) ch_calloc( 1,
sizeof( struct slap_session_entry ));
sent->se_id = se_id;
sent->se_size = se_size;
LDAP_LIST_INSERT_HEAD( &bdb->bi_session_list, sent, se_link );
#endif /* BDB_PSEARCH */
/* anything else */
} else {
return SLAP_CONF_UNKNOWN;

View File

@ -1,443 +0,0 @@
/* ctxcsn.c -- back-bdb Context CSN Management Routines */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2003-2005 The OpenLDAP Foundation.
* Portions Copyright 2003 IBM Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in the file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include <ac/time.h>
#include "lutil.h"
#include "back-bdb.h"
#ifdef BDB_PSEARCH
int
bdb_csn_commit(
Operation *op,
SlapReply *rs,
DB_TXN *tid,
EntryInfo *ei,
EntryInfo **suffix_ei,
Entry **ctxcsn_e,
int *ctxcsn_added,
u_int32_t locker
)
{
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
EntryInfo *ctxcsn_ei = NULL;
DB_LOCK ctxcsn_lock;
struct berval max_committed_csn;
DB_LOCK suffix_lock;
int rc, ret;
ID ctxcsn_id;
Entry *e;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
EntryInfo *eip = NULL;
assert( !BER_BVISNULL( &op->o_bd->be_context_csn ) );
if ( ei ) {
e = ei->bei_e;
}
rc = bdb_dn2entry( op, tid, &op->o_bd->be_context_csn, &ctxcsn_ei,
1, locker, &ctxcsn_lock );
switch( rc ) {
case 0:
case DB_NOTFOUND:
break;
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
return BDB_CSN_RETRY;
default:
return BDB_CSN_ABORT;
}
*ctxcsn_e = ctxcsn_ei->bei_e;
slap_get_commit_csn( op, &max_committed_csn );
if ( max_committed_csn.bv_val == NULL ) {
return BDB_CSN_COMMIT;
}
*ctxcsn_added = 0;
switch( rc ) {
case 0:
if ( !*ctxcsn_e ) {
rs->sr_err = LDAP_OTHER;
rs->sr_text = "context csn not present";
op->o_tmpfree( max_committed_csn.bv_val, op->o_tmpmemctx );
return BDB_CSN_ABORT;
} else {
Modifications mod;
struct berval modvals[2];
Entry dummy;
modvals[0] = max_committed_csn;
modvals[1].bv_val = NULL;
modvals[1].bv_len = 0;
mod.sml_op = LDAP_MOD_REPLACE;
mod.sml_values = modvals;
mod.sml_nvalues = NULL;
mod.sml_desc = slap_schema.si_ad_contextCSN;
mod.sml_type = mod.sml_desc->ad_cname;
mod.sml_next = NULL;
dummy = **ctxcsn_e;
ret = bdb_modify_internal( op, tid, &mod, &dummy,
&rs->sr_text, textbuf, textlen );
op->o_tmpfree( max_committed_csn.bv_val, op->o_tmpmemctx );
if ( ret != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_csn_commit: modify failed (%d)\n", rs->sr_err, 0, 0 );
if ( dummy.e_attrs != e->e_attrs ) attrs_free( dummy.e_attrs );
switch( ret ) {
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto rewind;
default:
return BDB_CSN_ABORT;
}
}
ret = bdb_id2entry_update( op->o_bd, tid, &dummy );
switch ( ret ) {
case 0 :
break;
case DB_LOCK_DEADLOCK :
case DB_LOCK_NOTGRANTED :
if ( dummy.e_attrs != e->e_attrs ) attrs_free( dummy.e_attrs );
goto rewind;
default :
if ( dummy.e_attrs != e->e_attrs ) attrs_free( dummy.e_attrs );
rs->sr_err = ret;
rs->sr_text = "context csn update failed";
return BDB_CSN_ABORT;
}
ret = bdb_cache_modify( *ctxcsn_e, dummy.e_attrs, bdb->bi_dbenv, locker, &ctxcsn_lock );
if ( ret != LDAP_SUCCESS ) {
if ( dummy.e_attrs != e->e_attrs ) attrs_free( dummy.e_attrs );
switch( ret ) {
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto rewind;
}
}
}
break;
case DB_NOTFOUND:
if ( op->o_tag == LDAP_REQ_ADD &&
be_issuffix( op->o_bd, &op->oq_add.rs_e->e_nname )) {
*suffix_ei = NULL;
eip = (EntryInfo *) ch_calloc( 1, sizeof( EntryInfo ));
eip->bei_id = op->oq_add.rs_e->e_id;
} else {
eip = *suffix_ei = ctxcsn_ei;
}
/* This serializes add. But this case is very rare : only once. */
rs->sr_err = bdb_next_id( op->o_bd, tid, &ctxcsn_id );
if ( rs->sr_err != 0 ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_csn_commit: next_id failed (%d)\n",
rs->sr_err, 0, 0 );
rs->sr_err = LDAP_OTHER;
rs->sr_text = "internal error";
return BDB_CSN_ABORT;
}
*ctxcsn_e = slap_create_context_csn_entry( op->o_bd, &max_committed_csn );
op->o_tmpfree( max_committed_csn.bv_val, op->o_tmpmemctx );
(*ctxcsn_e)->e_id = ctxcsn_id;
*ctxcsn_added = 1;
ret = bdb_dn2id_add( op, tid, eip, *ctxcsn_e );
switch ( ret ) {
case 0 :
break;
case DB_LOCK_DEADLOCK :
case DB_LOCK_NOTGRANTED :
goto rewind;
case DB_KEYEXIST :
rs->sr_err = LDAP_OTHER;
rs->sr_text = "context csn exists before context prefix does";
return BDB_CSN_ABORT;
default :
rs->sr_err = LDAP_OTHER;
rs->sr_text = "context csn store failed";
return BDB_CSN_ABORT;
}
if ( *suffix_ei == NULL ) {
ch_free( eip );
}
ret = bdb_id2entry_add( op->o_bd, tid, *ctxcsn_e );
switch ( ret ) {
case 0 :
break;
case DB_LOCK_DEADLOCK :
case DB_LOCK_NOTGRANTED :
goto rewind;
default :
rs->sr_err = LDAP_OTHER;
rs->sr_text = "context csn store failed";
return BDB_CSN_ABORT;
}
ret = bdb_index_entry_add( op, tid, *ctxcsn_e );
switch ( ret ) {
case 0 :
break;
case DB_LOCK_DEADLOCK :
case DB_LOCK_NOTGRANTED :
goto rewind;
default :
rs->sr_err = LDAP_OTHER;
rs->sr_text = "context csn indexing failed";
return BDB_CSN_ABORT;
}
break;
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
Debug( LDAP_DEBUG_TRACE,
"bdb_csn_commit : bdb_dn2entry retry\n", 0, 0, 0 );
goto rewind;
case LDAP_BUSY:
rs->sr_err = rc;
rs->sr_text = "ldap server busy";
return BDB_CSN_ABORT;
default:
rs->sr_err = LDAP_OTHER;
rs->sr_text = "internal error";
return BDB_CSN_ABORT;
}
return BDB_CSN_COMMIT;
rewind :
slap_rewind_commit_csn( op );
return BDB_CSN_RETRY;
}
int
bdb_get_commit_csn(
Operation *op,
SlapReply *rs,
struct berval **search_context_csn,
u_int32_t locker,
DB_LOCK *ctxcsn_lock
)
{
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
struct berval csn = BER_BVNULL;
EntryInfo *ctxcsn_ei = NULL;
EntryInfo *suffix_ei = NULL;
Entry *ctxcsn_e = NULL;
DB_TXN *ltid = NULL;
Attribute *csn_a;
char gid[DB_XIDDATASIZE];
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
int num_retries = 0;
int ctxcsn_added = 0;
int rc;
struct sync_cookie syncCookie = { NULL, -1, NULL};
syncinfo_t *si;
u_int32_t ctxcsn_locker = 0;
if ( (op->o_sync_mode & SLAP_SYNC_REFRESH) &&
!LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
char substr[67];
struct berval ctxcsn_ndn = BER_BVNULL;
struct berval bv;
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
sprintf( substr, "cn=syncrepl%ld", si->si_rid );
ber_str2bv( substr, 0, 0, &bv );
build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &bv, op->o_tmpmemctx );
consumer_ctxcsn_retry :
rs->sr_err = bdb_dn2entry( op, NULL, &ctxcsn_ndn, &ctxcsn_ei,
0, locker, ctxcsn_lock );
switch(rs->sr_err) {
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto consumer_ctxcsn_retry;
case 0:
op->o_tmpfree( ctxcsn_ndn.bv_val, op->o_tmpmemctx );
ctxcsn_ndn.bv_val = NULL;
if ( ctxcsn_ei ) {
ctxcsn_e = ctxcsn_ei->bei_e;
}
break;
case DB_NOTFOUND:
default:
rs->sr_err = LDAP_OTHER;
case LDAP_BUSY:
op->o_tmpfree( ctxcsn_ndn.bv_val, op->o_tmpmemctx );
ctxcsn_ndn.bv_val = NULL;
goto done;
}
if ( ctxcsn_e ) {
csn_a = attr_find( ctxcsn_e->e_attrs,
slap_schema.si_ad_syncreplCookie );
if ( csn_a ) {
struct berval cookie;
const char *text;
int match = -1;
ber_dupbv( &cookie, &csn_a->a_vals[0] );
ber_bvarray_add( &syncCookie.octet_str, &cookie );
slap_parse_sync_cookie( &syncCookie );
if ( *search_context_csn &&
(*search_context_csn)->bv_val != NULL )
{
value_match( &match, slap_schema.si_ad_entryCSN,
slap_schema.si_ad_entryCSN->ad_type->sat_ordering,
SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
syncCookie.ctxcsn, *search_context_csn, &text );
}
if ( match < 0 ) {
/* set search_context_csn to the
smallest syncrepl cookie value */
if ( *search_context_csn ) {
ch_free( (*search_context_csn)->bv_val );
ch_free( *search_context_csn );
}
*search_context_csn = ber_dupbv( NULL,
syncCookie.ctxcsn );
}
slap_sync_cookie_free( &syncCookie, 0 );
} else {
*search_context_csn = NULL;
}
} else {
*search_context_csn = NULL;
}
}
} else if ( (op->o_sync_mode & SLAP_SYNC_REFRESH) &&
LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
provider_ctxcsn_retry :
rs->sr_err = bdb_dn2entry( op, NULL, &op->o_bd->be_context_csn, &ctxcsn_ei,
0, locker, ctxcsn_lock );
switch(rs->sr_err) {
case 0:
if ( ctxcsn_ei ) {
ctxcsn_e = ctxcsn_ei->bei_e;
}
break;
case LDAP_BUSY:
goto done;
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto provider_ctxcsn_retry;
case DB_NOTFOUND:
snprintf( gid, sizeof( gid ), "%s-%08lx-%08lx",
bdb_uuid.bv_val, (long) op->o_connid, (long) op->o_opid );
slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
if ( 0 ) {
txn_retry:
rs->sr_err = TXN_ABORT( ltid );
ltid = NULL;
if ( rs->sr_err != 0 ) {
rs->sr_err = LDAP_OTHER;
goto done;
}
ldap_pvt_thread_yield();
bdb_trans_backoff( ++num_retries );
}
rs->sr_err = TXN_BEGIN( bdb->bi_dbenv, NULL,
&ltid, bdb->bi_db_opflags );
if ( rs->sr_err != 0 ) {
rs->sr_err = LDAP_OTHER;
goto done;
}
ctxcsn_locker = TXN_ID ( ltid );
rs->sr_err = bdb_csn_commit( op, rs, ltid, NULL,
&suffix_ei, &ctxcsn_e,
&ctxcsn_added, ctxcsn_locker );
switch( rs->sr_err ) {
case BDB_CSN_ABORT:
rs->sr_err = LDAP_OTHER;
goto done;
case BDB_CSN_RETRY:
goto txn_retry;
}
rs->sr_err = TXN_PREPARE( ltid, gid );
if ( rs->sr_err != 0 ) {
rs->sr_err = LDAP_OTHER;
goto done;
}
bdb_cache_add( bdb, suffix_ei, ctxcsn_e,
(struct berval *)&slap_ldapsync_cn_bv, ctxcsn_locker );
rs->sr_err = TXN_COMMIT( ltid, 0 );
if ( rs->sr_err != 0 ) {
rs->sr_err = LDAP_OTHER;
goto done;
}
rs->sr_err = bdb_dn2entry( op, NULL,
&op->o_bd->be_context_csn,
&ctxcsn_ei, 0, ctxcsn_locker,
ctxcsn_lock );
if ( ctxcsn_ei ) {
ctxcsn_e = ctxcsn_ei->bei_e;
}
break;
default:
rs->sr_err = LDAP_OTHER;
goto done;
}
if ( ctxcsn_e ) {
csn_a = attr_find( ctxcsn_e->e_attrs,
slap_schema.si_ad_contextCSN );
if ( csn_a ) {
*search_context_csn = ber_dupbv( NULL, &csn_a->a_vals[0] );
} else {
*search_context_csn = NULL;
}
} else {
*search_context_csn = NULL;
}
}
ltid = NULL;
rs->sr_err = LDAP_SUCCESS;
done:
if( ltid != NULL ) {
TXN_ABORT( ltid );
}
return rs->sr_err;
}
#endif

View File

@ -377,22 +377,6 @@ retry: /* transaction retry */
goto return_results;
}
#ifdef BDB_PSEARCH
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_PREDELETE );
if ( rc == LDAP_BUSY && op->o_ps_send_wait ) {
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
goto retry;
} else if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_delete) ": persistent search "
"failed (%d,%d)\n", rc, rs->sr_err, 0 );
}
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
#endif
/* delete from dn2id */
rs->sr_err = bdb_dn2id_delete( op, lt2, eip, e );
if ( rs->sr_err != 0 ) {
@ -482,21 +466,6 @@ retry: /* transaction retry */
ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
#endif
#ifdef BDB_PSEARCH
if ( !dn_match( &ctxcsn_ndn, &op->o_req_ndn ) &&
!be_issuffix( op->o_bd, &op->o_req_ndn ) &&
LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
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";
@ -513,43 +482,6 @@ retry: /* transaction retry */
goto retry;
}
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
if ( ctxcsn_added ) {
bdb_cache_add( bdb, suffix_ei,
ctxcsn_e, (struct berval *)&slap_ldapsync_cn_bv, locker );
}
}
if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) {
Attribute *a;
a = attr_find( e->e_attrs, slap_schema.si_ad_entryCSN );
if ( a ) {
if( (void *) e->e_attrs != (void *) (e+1)) {
attr_delete( &e->e_attrs, slap_schema.si_ad_entryCSN );
attr_merge_normalize_one( e, slap_schema.si_ad_entryCSN,
&op->o_sync_csn, NULL );
} else {
a->a_vals[0] = op->o_sync_csn;
}
} else {
/* Hm, the entryCSN ought to exist. ??? */
}
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE );
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_delete)
": persistent search failed "
"(%d,%d)\n",
rc, rs->sr_err, 0 );
}
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
}
#endif
rs->sr_err = TXN_COMMIT( ltid, 0 );
}
ltid = NULL;

View File

@ -85,11 +85,6 @@ bdb_db_init( BackendDB *be )
bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
bdb->bi_search_stack = NULL;
#ifdef BDB_PSEARCH
LDAP_LIST_INIT (&bdb->bi_psearch_list);
ldap_pvt_thread_rdwr_init ( &bdb->bi_pslist_rwlock );
#endif
ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
@ -468,68 +463,6 @@ bdb_db_destroy( BackendDB *be )
ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
}
#ifdef BDB_PSEARCH
ldap_pvt_thread_rdwr_destroy ( &bdb->bi_pslist_rwlock );
ps = LDAP_LIST_FIRST( &bdb->bi_psearch_list );
if ( ps ) {
psn = LDAP_LIST_NEXT( ps, o_ps_link );
saved_tmpmemctx = ps->o_tmpmemctx;
if (!BER_BVISNULL(&ps->o_req_dn)) {
slap_sl_free( ps->o_req_dn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->o_req_ndn)) {
slap_sl_free( ps->o_req_ndn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->ors_filterstr)) {
slap_sl_free(ps->ors_filterstr.bv_val, ps->o_tmpmemctx);
}
if (ps->ors_filter != NULL) {
filter_free_x(ps, ps->ors_filter);
}
if ( ps->ors_attrs != NULL) {
ps->o_tmpfree(ps->ors_attrs, ps->o_tmpmemctx);
}
slap_op_free( ps );
if ( saved_tmpmemctx ) {
slap_sl_mem_destroy( NULL, saved_tmpmemctx );
}
}
while ( psn ) {
ps = psn;
psn = LDAP_LIST_NEXT( ps, o_ps_link );
saved_tmpmemctx = ps->o_tmpmemctx;
if (!BER_BVISNULL(&ps->o_req_dn)) {
slap_sl_free( ps->o_req_dn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->o_req_ndn)) {
slap_sl_free( ps->o_req_ndn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->ors_filterstr)) {
slap_sl_free(ps->ors_filterstr.bv_val, ps->o_tmpmemctx);
}
if (ps->ors_filter != NULL) {
filter_free_x(ps, ps->ors_filter);
}
if ( ps->ors_attrs != NULL) {
ps->o_tmpfree(ps->ors_attrs, ps->o_tmpmemctx);
}
slap_op_free( ps );
if ( saved_tmpmemctx ) {
slap_sl_mem_destroy( NULL, saved_tmpmemctx );
}
}
#endif
ch_free( bdb );
be->be_private = NULL;

View File

@ -307,16 +307,6 @@ retry: /* transaction retry */
Debug(LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modify) ": retrying...\n", 0, 0, 0);
#ifdef BDB_PSEARCH
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_prev = pm_list;
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
#endif
rs->sr_err = TXN_ABORT( ltid );
ltid = NULL;
op->o_private = NULL;
@ -447,25 +437,6 @@ retry: /* transaction retry */
goto return_results;
}
#ifdef BDB_PSEARCH
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) {
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
if ( rc == LDAP_BUSY && op->o_ps_send_wait ) {
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
goto retry;
} else if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modify)
": persistent search failed (%d,%d)\n",
rc, rs->sr_err, 0 );
}
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
}
#endif
if( op->o_preread ) {
if( preread_ctrl == NULL ) {
preread_ctrl = &ctrls[num_ctrls++];
@ -537,19 +508,6 @@ retry: /* transaction retry */
goto return_results;
}
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
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_postread ) {
if( postread_ctrl == NULL ) {
postread_ctrl = &ctrls[num_ctrls++];
@ -583,47 +541,6 @@ retry: /* transaction retry */
}
dummy.e_attrs = NULL;
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
if ( ctxcsn_added ) {
bdb_cache_add( bdb, suffix_ei, ctxcsn_e,
(struct berval *)&slap_ldapsync_cn_bv, locker );
}
}
if ( rs->sr_err == LDAP_SUCCESS ) {
/* Loop through in-scope entries for each psearch spec */
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY );
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modify)
": persistent search failed "
"(%d,%d)\n",
rc, rs->sr_err, 0 );
}
}
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
rc = bdb_psearch(op, rs, pm_list->ps_op,
e, LDAP_PSEARCH_BY_SCOPEOUT);
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modify)
": persistent search failed "
"(%d,%d)\n",
rc, rs->sr_err, 0 );
}
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_prev = pm_list;
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
}
#endif
rs->sr_err = TXN_COMMIT( ltid, 0 );
}
ltid = NULL;
@ -663,15 +580,6 @@ return_results:
done:
if( ltid != NULL ) {
#ifdef BDB_PSEARCH
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_prev = pm_list;
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
#endif
TXN_ABORT( ltid );
op->o_private = NULL;
}

View File

@ -100,15 +100,6 @@ retry: /* transaction retry */
}
Debug( LDAP_DEBUG_TRACE, "==>" LDAP_XSTRING(bdb_modrdn)
": retrying...\n", 0, 0, 0 );
#ifdef BDB_PSEARCH
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_prev = pm_list;
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
#endif
rs->sr_err = TXN_ABORT( ltid );
ltid = NULL;
@ -720,23 +711,6 @@ retry: /* transaction retry */
dummy.e_attrs = e->e_attrs;
#ifdef BDB_PSEARCH
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop && !op->o_no_psearch ) {
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, &dummy, LDAP_PSEARCH_BY_PREMODIFY );
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modrdn)
": persistent search failed (%d,%d)\n",
rc, rs->sr_err, 0 );
}
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
}
#endif
/* modify entry */
rs->sr_err = bdb_modify_internal( op, lt2, &mod[0], &dummy,
&rs->sr_text, textbuf, textlen );
@ -805,19 +779,6 @@ retry: /* transaction retry */
goto return_results;
}
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
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_postread ) {
if( postread_ctrl == NULL ) {
postread_ctrl = &ctrls[num_ctrls++];
@ -853,47 +814,6 @@ retry: /* transaction retry */
new_dn.bv_val = NULL;
new_ndn.bv_val = NULL;
#ifdef BDB_PSEARCH
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
if ( ctxcsn_added ) {
bdb_cache_add( bdb, suffix_ei, ctxcsn_e,
(struct berval *)&slap_ldapsync_cn_bv, locker );
}
}
if ( rs->sr_err == LDAP_SUCCESS ) {
/* Loop through in-scope entries for each psearch spec */
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_MODIFY );
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modrdn)
": persistent search failed "
"(%d,%d)\n",
rc, rs->sr_err, 0 );
}
}
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
rc = bdb_psearch(op, rs, pm_list->ps_op,
e, LDAP_PSEARCH_BY_SCOPEOUT);
if ( rc ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(bdb_modrdn)
": persistent search failed "
"(%d,%d)\n",
rc, rs->sr_err, 0 );
}
pm_prev = pm_list;
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock );
}
#endif
if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) {
rs->sr_text = "txn_commit failed";
} else {
@ -980,15 +900,6 @@ done:
}
if( ltid != NULL ) {
#ifdef BDB_PSEARCH
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
while ( pm_list != NULL ) {
LDAP_LIST_REMOVE ( pm_list, ps_link );
pm_prev = pm_list;
pm_list = LDAP_LIST_NEXT ( pm_list, ps_link );
ch_free( pm_prev );
}
#endif
TXN_ABORT( ltid );
op->o_private = NULL;
}

File diff suppressed because it is too large Load Diff

View File

@ -21,13 +21,13 @@ XXSRCS = init.c tools.c config.c \
add.c bind.c compare.c delete.c modify.c modrdn.c search.c \
extended.c referral.c operational.c \
attr.c index.c key.c dbcache.c filterindex.c trans.c \
dn2entry.c dn2id.c error.c id2entry.c idl.c nextid.c cache.c ctxcsn.c
dn2entry.c dn2id.c error.c id2entry.c idl.c nextid.c cache.c
SRCS = $(XXSRCS)
OBJS = init.lo tools.lo config.lo \
add.lo bind.lo compare.lo delete.lo modify.lo modrdn.lo search.lo \
extended.lo referral.lo operational.lo \
attr.lo index.lo key.lo dbcache.lo filterindex.lo trans.lo \
dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo cache.lo ctxcsn.lo
dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo cache.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries