mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 16:19:35 -05:00
ITS#7255 in mdb_tool_entry_modify use the existing global txn
This commit is contained in:
parent
1d89901e73
commit
34240dbbbb
1 changed files with 15 additions and 13 deletions
|
|
@ -881,7 +881,6 @@ ID mdb_tool_entry_modify(
|
|||
{
|
||||
int rc;
|
||||
struct mdb_info *mdb;
|
||||
MDB_txn *tid;
|
||||
Operation op = {0};
|
||||
Opheader ohdr = {0};
|
||||
|
||||
|
|
@ -904,15 +903,17 @@ ID mdb_tool_entry_modify(
|
|||
mdb_cursor_close( cursor );
|
||||
cursor = NULL;
|
||||
}
|
||||
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, 0, &tid );
|
||||
if( rc != 0 ) {
|
||||
snprintf( text->bv_val, text->bv_len,
|
||||
"txn_begin failed: %s (%d)",
|
||||
mdb_strerror(rc), rc );
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> " LDAP_XSTRING(mdb_tool_entry_modify) ": %s\n",
|
||||
text->bv_val, 0, 0 );
|
||||
return NOID;
|
||||
if ( !txn ) {
|
||||
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, 0, &txn );
|
||||
if( rc != 0 ) {
|
||||
snprintf( text->bv_val, text->bv_len,
|
||||
"txn_begin failed: %s (%d)",
|
||||
mdb_strerror(rc), rc );
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> " LDAP_XSTRING(mdb_tool_entry_modify) ": %s\n",
|
||||
text->bv_val, 0, 0 );
|
||||
return NOID;
|
||||
}
|
||||
}
|
||||
|
||||
op.o_hdr = &ohdr;
|
||||
|
|
@ -921,7 +922,7 @@ ID mdb_tool_entry_modify(
|
|||
op.o_tmpmfuncs = &ch_mfuncs;
|
||||
|
||||
/* id2entry index */
|
||||
rc = mdb_id2entry_update( &op, tid, NULL, e );
|
||||
rc = mdb_id2entry_update( &op, txn, NULL, e );
|
||||
if( rc != 0 ) {
|
||||
snprintf( text->bv_val, text->bv_len,
|
||||
"id2entry_update failed: err=%d", rc );
|
||||
|
|
@ -933,7 +934,7 @@ ID mdb_tool_entry_modify(
|
|||
|
||||
done:
|
||||
if( rc == 0 ) {
|
||||
rc = mdb_txn_commit( tid );
|
||||
rc = mdb_txn_commit( txn );
|
||||
if( rc != 0 ) {
|
||||
snprintf( text->bv_val, text->bv_len,
|
||||
"txn_commit failed: %s (%d)",
|
||||
|
|
@ -945,7 +946,7 @@ done:
|
|||
}
|
||||
|
||||
} else {
|
||||
mdb_txn_abort( tid );
|
||||
mdb_txn_abort( txn );
|
||||
snprintf( text->bv_val, text->bv_len,
|
||||
"txn_aborted! %s (%d)",
|
||||
mdb_strerror(rc), rc );
|
||||
|
|
@ -954,6 +955,7 @@ done:
|
|||
text->bv_val, 0, 0 );
|
||||
e->e_id = NOID;
|
||||
}
|
||||
txn = NULL;
|
||||
|
||||
return e->e_id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue