More explicit logging if mdb_txn_commit fails

Change LDAP_DEBUG_TRACE to LDAP_DEBUG_ANY.
Add log msg if it wasn't being logged before.
This commit is contained in:
Howard Chu 2013-02-02 05:31:39 -08:00
parent bc4e47a5a4
commit 33c98df18e
7 changed files with 21 additions and 6 deletions

View file

@ -411,7 +411,7 @@ txnReturn:
txn = NULL;
if ( rs->sr_err != 0 ) {
rs->sr_text = "txn_commit failed";
Debug( LDAP_DEBUG_TRACE,
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_add) ": %s : %s (%d)\n",
rs->sr_text, mdb_strerror(rs->sr_err), rs->sr_err );
rs->sr_err = LDAP_OTHER;

View file

@ -194,8 +194,13 @@ mdb_online_index( void *ctx, void *arg )
mdb_txn_abort( txn );
txn = NULL;
}
if ( rc )
if ( rc ) {
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_online_index) ": database %s: "
"txn_commit failed: %s (%d)\n",
be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
break;
}
id++;
getnext = 1;
}

View file

@ -418,7 +418,7 @@ txnReturn:
}
if( rs->sr_err != 0 ) {
Debug( LDAP_DEBUG_TRACE,
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_delete) ": txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit",
mdb_strerror(rs->sr_err), rs->sr_err );

View file

@ -242,6 +242,10 @@ mdb_db_open( BackendDB *be, ConfigReply *cr )
rc = mdb_txn_commit(txn);
if ( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_db_open) ": database %s: "
"txn_commit failed: %s (%d)\n",
be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
goto fail;
}

View file

@ -629,7 +629,7 @@ txnReturn:
}
if( rs->sr_err != 0 ) {
Debug( LDAP_DEBUG_TRACE,
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_modify) ": txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit",
mdb_strerror(rs->sr_err), rs->sr_err );

View file

@ -594,7 +594,7 @@ txnReturn:
}
if( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_modrdn) ": %s : %s (%d)\n",
rs->sr_text, mdb_strerror(rs->sr_err), rs->sr_err );
rs->sr_err = LDAP_OTHER;

View file

@ -165,9 +165,15 @@ int mdb_tool_entry_close(
cursor = NULL;
}
if( txn ) {
int rc;
MDB_TOOL_IDL_FLUSH( be, txn );
if ( mdb_txn_commit( txn ))
if (( rc = mdb_txn_commit( txn ))) {
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_tool_entry_close) ": database %s: "
"txn_commit failed: %s (%d)\n",
be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
return -1;
}
txn = NULL;
}