}
Debug( LDAP_DEBUG_TRACE, "==> bdb_delete: retrying...\n",
0, 0, 0 );
- rc = txn_abort( ltid );
+ rc = TXN_ABORT( ltid );
ltid = NULL;
op->o_private = NULL;
if( rc != 0 ) {
ldap_pvt_thread_yield();
}
- if( bdb->bi_txn ) {
- /* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id,
- bdb->bi_db_opflags );
- text = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_TRACE,
- "bdb_delete: txn_begin failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- rc = LDAP_OTHER;
- text = "internal error";
- goto return_results;
- }
+ /* begin transaction */
+ rc = TXN_BEGIN( bdb->bi_dbenv, NULL, <id,
+ bdb->bi_db_opflags );
+ text = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "bdb_delete: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ rc = LDAP_OTHER;
+ text = "internal error";
+ goto return_results;
+ }
#if 0
- lockid = TXN_ID( ltid );
+ lockid = TXN_ID( ltid );
#endif
- }
opinfo.boi_bdb = be;
opinfo.boi_txn = ltid;
op->o_private = &opinfo;
if ( !be_issuffix( be, ndn ) ) {
- rc = dnParent( ndn, &pdn );
- if ( rc != LDAP_SUCCESS ) {
- text = "internal error";
- goto return_results;
- }
+ dnParent( ndn, &pdn );
}
if( pdn.bv_len != 0 ) {
}
if ( !manageDSAit && is_entry_referral( e ) ) {
- /* parent is a referral, don't allow add */
- /* parent is an alias, don't allow add */
+ /* entry is a referral, don't allow delete */
BerVarray refs = get_entry_referrals( be,
conn, op, e );
ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
#endif
- if( bdb->bi_txn ) {
- rc = txn_commit( ltid, 0 );
+ if( op->o_noop ) {
+ rc = TXN_ABORT( ltid );
+ } else {
+ rc = TXN_COMMIT( ltid, 0 );
}
ltid = NULL;
op->o_private = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
- "bdb_delete: txn_commit failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
+ "bdb_delete: txn_%s failed: %s (%d)\n",
+ op->o_noop ? "abort (no-op)" : "commit",
+ db_strerror(rc), rc );
rc = LDAP_OTHER;
text = "commit failed";
} else {
Debug( LDAP_DEBUG_TRACE,
- "bdb_delete: deleted id=%08lx dn=\"%s\"\n",
- e->e_id, e->e_dn, 0 );
+ "bdb_delete: deleted%s id=%08lx dn=\"%s\"\n",
+ op->o_noop ? " (no-op)" : "",
+ e->e_id, e->e_dn );
rc = LDAP_SUCCESS;
text = NULL;
}
return_results:
- send_ldap_result( conn, op, LDAP_SUCCESS,
- NULL, text, NULL, NULL );
+ send_ldap_result( conn, op, rc, NULL, text, NULL, NULL );
if(rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
ldap_pvt_thread_yield();
}
if( ltid != NULL ) {
- txn_abort( ltid );
+ TXN_ABORT( ltid );
op->o_private = NULL;
}