gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated: even more logging o


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: even more logging on DB issues
Date: Fri, 07 Apr 2017 11:24:19 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new a2d89f2  even more logging on DB issues
a2d89f2 is described below

commit a2d89f2803128a19f87cf1ad55b1c72a173e812e
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Apr 7 11:24:16 2017 +0200

    even more logging on DB issues
---
 src/exchange/taler-exchange-httpd_db.c      |  4 +++-
 src/exchangedb/plugin_exchangedb_postgres.c | 36 ++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_db.c 
b/src/exchange/taler-exchange-httpd_db.c
index 9e345e8..191e2a4 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -593,7 +593,7 @@ TEH_DB_execute_refund (struct MHD_Connection *connection,
     return TEH_RESPONSE_reply_internal_db_error (connection,
                                                 
TALER_EC_REFUND_STORE_DB_ERROR);
   }
-  COMMIT_TRANSACTION(session, connection);
+  COMMIT_TRANSACTION (session, connection);
 
   return TEH_RESPONSE_reply_refund_success (connection,
                                             refund);
@@ -622,9 +622,11 @@ TEH_DB_execute_reserve_status (struct MHD_Connection 
*connection,
     return TEH_RESPONSE_reply_internal_db_error (connection,
                                                 TALER_EC_DB_SETUP_FAILED);
   }
+  START_TRANSACTION (session, connection);
   rh = TEH_plugin->get_reserve_history (TEH_plugin->cls,
                                         session,
                                         reserve_pub);
+  COMMIT_TRANSACTION (session, connection);
   if (NULL == rh)
     return TEH_RESPONSE_reply_json_pack (connection,
                                          MHD_HTTP_NOT_FOUND,
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index d2a2bba..f859540 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -34,9 +34,17 @@
  * Log a query error.
  *
  * @param result PQ result object of the query that failed
+ * @param conn SQL connection that was used
  */
-#define QUERY_ERR(result)                          \
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Query failed at %s:%u: %s (%s)\n", 
__FILE__, __LINE__, PQresultErrorMessage (result), PQresStatus (PQresultStatus 
(result)))
+#define QUERY_ERR(result,conn)                         \
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,             \
+              "Query failed at %s:%u: %s/%s/%s/%s/%s\n", \
+              __FILE__, __LINE__, \
+              PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
+              PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
+              PQresultErrorMessage (result), \
+              PQresStatus (PQresultStatus (result)), \
+              PQerrorMessage(conn));
 
 
 /**
@@ -1755,7 +1763,7 @@ postgres_get_denomination_info (void *cls,
                                    params);
   if (PGRES_TUPLES_OK != PQresultStatus (result))
   {
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     PQclear (result);
     return GNUNET_SYSERR;
   }
@@ -1846,7 +1854,7 @@ postgres_reserve_get (void *cls,
                                    params);
   if (PGRES_TUPLES_OK != PQresultStatus (result))
   {
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     PQclear (result);
     return GNUNET_SYSERR;
   }
@@ -1906,7 +1914,7 @@ reserves_update (void *cls,
                                    params);
   if (PGRES_COMMAND_OK != PQresultStatus(result))
   {
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     ret = GNUNET_SYSERR;
   }
   else
@@ -1987,7 +1995,7 @@ postgres_reserves_in_insert (void *cls,
                                       params);
     if (PGRES_COMMAND_OK != PQresultStatus(result))
     {
-      QUERY_ERR (result);
+      QUERY_ERR (result, session->conn);
       PQclear (result);
       goto rollback;
     }
@@ -2031,7 +2039,7 @@ postgres_reserves_in_insert (void *cls,
                         session);
       return GNUNET_NO;
     }
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     PQclear (result);
     goto rollback;
   }
@@ -2116,7 +2124,7 @@ postgres_get_withdraw_info (void *cls,
 
   if (PGRES_TUPLES_OK != PQresultStatus (result))
   {
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     goto cleanup;
   }
   if (0 == PQntuples (result))
@@ -2197,7 +2205,7 @@ postgres_insert_withdraw_info (void *cls,
                                    params);
   if (PGRES_COMMAND_OK != PQresultStatus (result))
   {
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     PQclear (result);
     return GNUNET_SYSERR;
   }
@@ -2277,7 +2285,7 @@ postgres_get_reserve_history (void *cls,
                                       params);
     if (PGRES_TUPLES_OK != PQresultStatus (result))
     {
-      QUERY_ERR (result);
+      QUERY_ERR (result, session->conn);
       goto cleanup;
     }
     if (0 == (rows = PQntuples (result)))
@@ -2343,7 +2351,7 @@ postgres_get_reserve_history (void *cls,
                                       params);
     if (PGRES_TUPLES_OK != PQresultStatus (result))
     {
-      QUERY_ERR (result);
+      QUERY_ERR (result, session->conn);
       PQclear (result);
       goto cleanup;
     }
@@ -2402,7 +2410,7 @@ postgres_get_reserve_history (void *cls,
                                       params);
     if (PGRES_TUPLES_OK != PQresultStatus (result))
     {
-      QUERY_ERR (result);
+      QUERY_ERR (result, session->conn);
       goto cleanup;
     }
     rows = PQntuples (result);
@@ -3979,7 +3987,7 @@ postgres_get_coin_transactions (void *cls,
                                       params);
     if (PGRES_TUPLES_OK != PQresultStatus (result))
     {
-      QUERY_ERR (result);
+      QUERY_ERR (result, session->conn);
       PQclear (result);
       goto cleanup;
     }
@@ -4836,7 +4844,7 @@ postgres_wire_prepare_data_get (void *cls,
                                    params);
   if (PGRES_TUPLES_OK != PQresultStatus (result))
   {
-    QUERY_ERR (result);
+    QUERY_ERR (result, session->conn);
     PQclear (result);
     return GNUNET_SYSERR;
   }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]