DB_RMW flag to dn2id and id2entry

This commit is contained in:
Jong Hyuk Choi 2002-06-10 19:02:25 +00:00
parent 9bfcc3b4e2
commit 09a2a8fbce
8 changed files with 23 additions and 17 deletions

View file

@ -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:

View file

@ -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 ) {

View file

@ -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

View file

@ -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;

View file

@ -356,7 +356,7 @@ retry: /* transaction retry */
ber_bvarray_free( refs );
free( matched_dn );
return rc;
goto done;
}
if ( !manageDSAit && is_entry_referral( e ) ) {

View file

@ -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:

View file

@ -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:

View file

@ -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(