From: Howard Chu Date: Sat, 2 Feb 2013 13:31:39 +0000 (-0800) Subject: More explicit logging if mdb_txn_commit fails X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=33c98df18e5002696328fa44cfe92c7989acebbc;p=openldap 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. --- diff --git a/servers/slapd/back-mdb/add.c b/servers/slapd/back-mdb/add.c index 02084247fe..332d5c6b21 100644 --- a/servers/slapd/back-mdb/add.c +++ b/servers/slapd/back-mdb/add.c @@ -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; diff --git a/servers/slapd/back-mdb/config.c b/servers/slapd/back-mdb/config.c index 5d9383e00a..fa11d8c1f3 100644 --- a/servers/slapd/back-mdb/config.c +++ b/servers/slapd/back-mdb/config.c @@ -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; } diff --git a/servers/slapd/back-mdb/delete.c b/servers/slapd/back-mdb/delete.c index c1e9494966..1735fee799 100644 --- a/servers/slapd/back-mdb/delete.c +++ b/servers/slapd/back-mdb/delete.c @@ -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 ); diff --git a/servers/slapd/back-mdb/init.c b/servers/slapd/back-mdb/init.c index 82a6d70ae5..8833de4089 100644 --- a/servers/slapd/back-mdb/init.c +++ b/servers/slapd/back-mdb/init.c @@ -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; } diff --git a/servers/slapd/back-mdb/modify.c b/servers/slapd/back-mdb/modify.c index 06393d0bdd..1ea664f4fe 100644 --- a/servers/slapd/back-mdb/modify.c +++ b/servers/slapd/back-mdb/modify.c @@ -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 ); diff --git a/servers/slapd/back-mdb/modrdn.c b/servers/slapd/back-mdb/modrdn.c index aa8a085384..de3a219721 100644 --- a/servers/slapd/back-mdb/modrdn.c +++ b/servers/slapd/back-mdb/modrdn.c @@ -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; diff --git a/servers/slapd/back-mdb/tools.c b/servers/slapd/back-mdb/tools.c index 3747c7ad07..2ef6091dad 100644 --- a/servers/slapd/back-mdb/tools.c +++ b/servers/slapd/back-mdb/tools.c @@ -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; }