int
bdb_cache_find_ndn(
Operation *op,
- DB_TXN *txn,
+ BDB_LOCKER locker,
struct berval *ndn,
EntryInfo **res )
{
(ei.bei_nrdn.bv_val - ndn->bv_val);
bdb_cache_entryinfo_unlock( eip );
- rc = bdb_dn2id( op, txn, &ei.bei_nrdn, &ei );
+ rc = bdb_dn2id( op, locker, &ei.bei_nrdn, &ei );
if (rc) {
bdb_cache_entryinfo_lock( eip );
*res = eip;
#ifndef BDB_HIER
rc = bdb_id2entry( op->o_bd, tid, locker, id, &ep );
if ( rc == 0 ) {
- rc = bdb_cache_find_ndn( op, tid,
+ rc = bdb_cache_find_ndn( op, locker,
&ep->e_nname, eip );
if ( *eip ) flag |= ID_LOCKED;
if ( rc ) {
*e = NULL;
- rc = bdb_cache_find_ndn( op, tid, dn, &ei );
+ rc = bdb_cache_find_ndn( op, locker, dn, &ei );
if ( rc ) {
if ( matched && rc == DB_NOTFOUND ) {
/* Set the return value, whether we have its entry
int
bdb_dn2id(
Operation *op,
- DB_TXN *txn,
+ BDB_LOCKER locker,
struct berval *dn,
EntryInfo *ei )
{
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
DB *db = bdb->bi_dn2id->bdi_db;
+ DBC *cursor;
int rc;
DBT key, data;
ID nid;
data.ulen = sizeof(ID);
data.flags = DB_DBT_USERMEM;
+ rc = db->cursor( db, NULL, &cursor, bdb->bi_db_opflags );
+ if ( rc ) return rc;
+ if ( locker ) {
+ CURSOR_SETLOCKER(cursor, locker);
+ }
+
/* fetch it */
- rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
+ rc = cursor->c_get( cursor, &key, &data, DB_SET );
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n",
ei->bei_id, 0, 0 );
}
+ cursor->c_close( cursor );
op->o_tmpfree( key.data, op->o_tmpmemctx );
return rc;
}
int
hdb_dn2id(
Operation *op,
- DB_TXN *txn,
+ BDB_LOCKER locker,
struct berval *in,
EntryInfo *ei )
{
data.dlen = data.ulen;
data.flags = DB_DBT_USERMEM | DB_DBT_PARTIAL;
- rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags );
+ rc = db->cursor( db, NULL, &cursor, bdb->bi_db_opflags );
if ( rc ) return rc;
+ if ( locker ) {
+ CURSOR_SETLOCKER( cursor, locker );
+ }
d = op->o_tmpalloc( data.size * 3, op->o_tmpmemctx );
d->nrdnlen[1] = nrlen & 0xff;
BDB_IDL_ZERO( ids );
if ( mra->ma_rule == slap_schema.si_mr_distinguishedNameMatch ) {
ei = NULL;
- rc = bdb_cache_find_ndn( op, NULL, &mra->ma_value, &ei );
+ rc = bdb_cache_find_ndn( op, locker, &mra->ma_value, &ei );
if ( rc == LDAP_SUCCESS )
bdb_idl_insert( ids, ei->bei_id );
if ( ei )
struct berval pdn;
ei = NULL;
dnParent( &mra->ma_value, &pdn );
- bdb_cache_find_ndn( op, NULL, &pdn, &ei );
+ bdb_cache_find_ndn( op, locker, &pdn, &ei );
if ( ei ) {
bdb_cache_entryinfo_unlock( ei );
while ( ei && ei->bei_id ) {
scope = LDAP_SCOPE_BASE;
if ( scope > LDAP_SCOPE_BASE ) {
ei = NULL;
- rc = bdb_cache_find_ndn( op, NULL, &mra->ma_value, &ei );
+ rc = bdb_cache_find_ndn( op, locker, &mra->ma_value, &ei );
if ( ei )
bdb_cache_entryinfo_unlock( ei );
if ( rc == LDAP_SUCCESS ) {
/* Shortcut the search */
nei = neip ? neip : eip;
- rs->sr_err = bdb_cache_find_ndn ( op, ltid, &new_ndn, &nei );
+ rs->sr_err = bdb_cache_find_ndn ( op, locker, &new_ndn, &nei );
if ( nei ) bdb_cache_entryinfo_unlock( nei );
switch( rs->sr_err ) {
case DB_LOCK_DEADLOCK:
int bdb_dn2id(
Operation *op,
- DB_TXN *tid,
+ BDB_LOCKER locker,
struct berval *dn,
EntryInfo *ei );
);
int bdb_cache_find_ndn(
Operation *op,
- DB_TXN *txn,
+ BDB_LOCKER locker,
struct berval *ndn,
EntryInfo **res
);
op.o_tmpmemctx = NULL;
op.o_tmpmfuncs = &ch_mfuncs;
- rc = bdb_cache_find_ndn( &op, NULL, dn, &ei );
+ rc = bdb_cache_find_ndn( &op, 0, dn, &ei );
if ( ei ) bdb_cache_entryinfo_unlock( ei );
if ( rc == DB_NOTFOUND )
return NOID;
return 0;
}
- rc = bdb_cache_find_ndn( op, tid, &ndn, &ei );
+ rc = bdb_cache_find_ndn( op, TXN_ID( tid ), &ndn, &ei );
if ( ei ) bdb_cache_entryinfo_unlock( ei );
if ( rc == DB_NOTFOUND ) {
if ( !be_issuffix( op->o_bd, &ndn ) ) {