From: Jong Hyuk Choi Date: Mon, 10 Jun 2002 19:02:25 +0000 (+0000) Subject: DB_RMW flag to dn2id and id2entry X-Git-Tag: NO_SLAP_OP_BLOCKS~1486 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=09a2a8fbcee2406090542e37c5c8246d5d37e1ed;p=openldap DB_RMW flag to dn2id and id2entry --- diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index a348631cc7..8c26e9a080 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -309,7 +309,7 @@ retry: /* transaction retry */ goto done; } - rc = bdb_dn2id_children( be, ltid, &e->e_nname ); + rc = bdb_dn2id_children( be, ltid, &e->e_nname, 0 ); if( rc != DB_NOTFOUND ) { switch( rc ) { case DB_LOCK_DEADLOCK: diff --git a/servers/slapd/back-bdb/dn2entry.c b/servers/slapd/back-bdb/dn2entry.c index a6440536f7..4975141130 100644 --- a/servers/slapd/back-bdb/dn2entry.c +++ b/servers/slapd/back-bdb/dn2entry.c @@ -44,9 +44,9 @@ bdb_dn2entry_rw( if( matched != NULL ) { *matched = NULL; - rc = bdb_dn2id_matched( be, tid, dn, &id, &id2 ); + rc = bdb_dn2id_matched( be, tid, dn, &id, &id2, flags ); } else { - rc = bdb_dn2id( be, tid, dn, &id ); + rc = bdb_dn2id( be, tid, dn, &id, flags ); } if( rc != 0 ) { diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index d9792904fb..ea63172b6a 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -270,7 +270,8 @@ bdb_dn2id( BackendDB *be, DB_TXN *txn, struct berval *dn, - ID *id ) + ID *id, + int flags ) { int rc; DBT key, data; @@ -304,7 +305,7 @@ bdb_dn2id( data.flags = DB_DBT_USERMEM; /* fetch it */ - rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags ); + rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags | flags); if( rc != 0 ) { #ifdef NEW_LOGGING @@ -335,7 +336,8 @@ bdb_dn2id_matched( DB_TXN *txn, struct berval *in, ID *id, - ID *id2 ) + ID *id2, + int flags ) { int rc; DBT key, data; @@ -383,7 +385,7 @@ bdb_dn2id_matched( break; } else { /* fetch it */ - rc = db->get(db, txn, &key, &data, bdb->bi_db_opflags ); + rc = db->get(db, txn, &key, &data, bdb->bi_db_opflags | flags ); } if( rc == DB_NOTFOUND ) { @@ -459,7 +461,8 @@ int bdb_dn2id_children( BackendDB *be, DB_TXN *txn, - struct berval *dn ) + struct berval *dn, + int flags ) { int rc; DBT key, data; @@ -489,7 +492,7 @@ bdb_dn2id_children( data.doff = 0; data.dlen = sizeof(id); - rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags ); + rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags | flags ); free( key.data ); #ifdef NEW_LOGGING diff --git a/servers/slapd/back-bdb/id2entry.c b/servers/slapd/back-bdb/id2entry.c index 0a841cab21..ef377fd5bd 100644 --- a/servers/slapd/back-bdb/id2entry.c +++ b/servers/slapd/back-bdb/id2entry.c @@ -104,7 +104,7 @@ int bdb_id2entry_rw( } /* fetch it */ - rc = db->get( db, tid, &key, &data, bdb->bi_db_opflags ); + rc = db->get( db, tid, &key, &data, bdb->bi_db_opflags | ( rw ? DB_RMW : 0 )); if( rc != 0 ) { return rc; diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index d205b60060..a6c80c3992 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -356,7 +356,7 @@ retry: /* transaction retry */ ber_bvarray_free( refs ); free( matched_dn ); - return rc; + goto done; } if ( !manageDSAit && is_entry_referral( e ) ) { diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 30f345c7f0..439fcc2b5d 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -130,7 +130,7 @@ retry: /* transaction retry */ op->o_private = &opinfo; /* get entry */ - rc = bdb_dn2entry_w( be, ltid, ndn, &e, &matched, 0, locker, &lock ); + rc = bdb_dn2entry_w( be, ltid, ndn, &e, &matched, DB_RMW, locker, &lock ); switch( rc ) { case 0: @@ -520,7 +520,7 @@ retry: /* transaction retry */ new_ndn.bv_val, 0, 0 ); #endif - rc = bdb_dn2id ( be, ltid, &new_ndn, &id ); + rc = bdb_dn2id ( be, ltid, &new_ndn, &id, 0 ); switch( rc ) { case DB_LOCK_DEADLOCK: case DB_LOCK_NOTGRANTED: diff --git a/servers/slapd/back-bdb/operational.c b/servers/slapd/back-bdb/operational.c index 5278c23ba3..9cff5cb3fc 100644 --- a/servers/slapd/back-bdb/operational.c +++ b/servers/slapd/back-bdb/operational.c @@ -87,7 +87,7 @@ retry: /* transaction retry */ opinfo.boi_err = 0; op->o_private = &opinfo; - rc = bdb_dn2id_children( be, ltid, &e->e_nname ); + rc = bdb_dn2id_children( be, ltid, &e->e_nname, 0 ); switch( rc ) { case DB_LOCK_DEADLOCK: diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index f5c7af92fd..7adf2f0d47 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -69,14 +69,16 @@ int bdb_dn2id( BackendDB *be, DB_TXN *tid, struct berval *dn, - ID *id ); + ID *id, + int flags ); int bdb_dn2id_matched( BackendDB *be, DB_TXN *tid, struct berval *dn, ID *id, - ID *id2 ); + ID *id2, + int flags ); int bdb_dn2id_add( BackendDB *be, @@ -93,7 +95,8 @@ int bdb_dn2id_delete( int bdb_dn2id_children( BackendDB *be, DB_TXN *tid, - struct berval *dn ); + struct berval *dn, + int flags ); int bdb_dn2idl(