mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-01 03:19:27 -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;
|
int rc;
|
||||||
struct mdb_info *mdb;
|
struct mdb_info *mdb;
|
||||||
MDB_txn *tid;
|
|
||||||
Operation op = {0};
|
Operation op = {0};
|
||||||
Opheader ohdr = {0};
|
Opheader ohdr = {0};
|
||||||
|
|
||||||
|
|
@ -904,15 +903,17 @@ ID mdb_tool_entry_modify(
|
||||||
mdb_cursor_close( cursor );
|
mdb_cursor_close( cursor );
|
||||||
cursor = NULL;
|
cursor = NULL;
|
||||||
}
|
}
|
||||||
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, 0, &tid );
|
if ( !txn ) {
|
||||||
if( rc != 0 ) {
|
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, 0, &txn );
|
||||||
snprintf( text->bv_val, text->bv_len,
|
if( rc != 0 ) {
|
||||||
"txn_begin failed: %s (%d)",
|
snprintf( text->bv_val, text->bv_len,
|
||||||
mdb_strerror(rc), rc );
|
"txn_begin failed: %s (%d)",
|
||||||
Debug( LDAP_DEBUG_ANY,
|
mdb_strerror(rc), rc );
|
||||||
"=> " LDAP_XSTRING(mdb_tool_entry_modify) ": %s\n",
|
Debug( LDAP_DEBUG_ANY,
|
||||||
text->bv_val, 0, 0 );
|
"=> " LDAP_XSTRING(mdb_tool_entry_modify) ": %s\n",
|
||||||
return NOID;
|
text->bv_val, 0, 0 );
|
||||||
|
return NOID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
op.o_hdr = &ohdr;
|
op.o_hdr = &ohdr;
|
||||||
|
|
@ -921,7 +922,7 @@ ID mdb_tool_entry_modify(
|
||||||
op.o_tmpmfuncs = &ch_mfuncs;
|
op.o_tmpmfuncs = &ch_mfuncs;
|
||||||
|
|
||||||
/* id2entry index */
|
/* id2entry index */
|
||||||
rc = mdb_id2entry_update( &op, tid, NULL, e );
|
rc = mdb_id2entry_update( &op, txn, NULL, e );
|
||||||
if( rc != 0 ) {
|
if( rc != 0 ) {
|
||||||
snprintf( text->bv_val, text->bv_len,
|
snprintf( text->bv_val, text->bv_len,
|
||||||
"id2entry_update failed: err=%d", rc );
|
"id2entry_update failed: err=%d", rc );
|
||||||
|
|
@ -933,7 +934,7 @@ ID mdb_tool_entry_modify(
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if( rc == 0 ) {
|
if( rc == 0 ) {
|
||||||
rc = mdb_txn_commit( tid );
|
rc = mdb_txn_commit( txn );
|
||||||
if( rc != 0 ) {
|
if( rc != 0 ) {
|
||||||
snprintf( text->bv_val, text->bv_len,
|
snprintf( text->bv_val, text->bv_len,
|
||||||
"txn_commit failed: %s (%d)",
|
"txn_commit failed: %s (%d)",
|
||||||
|
|
@ -945,7 +946,7 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mdb_txn_abort( tid );
|
mdb_txn_abort( txn );
|
||||||
snprintf( text->bv_val, text->bv_len,
|
snprintf( text->bv_val, text->bv_len,
|
||||||
"txn_aborted! %s (%d)",
|
"txn_aborted! %s (%d)",
|
||||||
mdb_strerror(rc), rc );
|
mdb_strerror(rc), rc );
|
||||||
|
|
@ -954,6 +955,7 @@ done:
|
||||||
text->bv_val, 0, 0 );
|
text->bv_val, 0, 0 );
|
||||||
e->e_id = NOID;
|
e->e_id = NOID;
|
||||||
}
|
}
|
||||||
|
txn = NULL;
|
||||||
|
|
||||||
return e->e_id;
|
return e->e_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue