diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-06-07 15:59:35 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-06-07 15:59:35 +0200 |
commit | f0bcbf65862c8e44e245bda21ea078803dcd5ad0 (patch) | |
tree | 1ba0b19ced8dfe8b024926dd4f37a910cc25c803 | |
parent | b9a30d29cb91ec66c3bb8d956640d20e641b6a4d (diff) | |
download | exchange-f0bcbf65862c8e44e245bda21ea078803dcd5ad0.tar.xz |
allow double-rollback, warn on rollback+commit
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index e933bfcfd..355508d4f 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -4165,6 +4165,7 @@ postgres_start (void *cls, GNUNET_PQ_EXECUTE_STATEMENT_END }; + GNUNET_assert (NULL != name); if (GNUNET_SYSERR == postgres_preflight (pg)) return GNUNET_SYSERR; @@ -4202,6 +4203,7 @@ postgres_start_read_committed (void *cls, GNUNET_PQ_EXECUTE_STATEMENT_END }; + GNUNET_assert (NULL != name); if (GNUNET_SYSERR == postgres_preflight (pg)) return GNUNET_SYSERR; @@ -4235,9 +4237,14 @@ postgres_rollback (void *cls) GNUNET_PQ_EXECUTE_STATEMENT_END }; + if (NULL == pg->transaction_name) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Skipping rollback, no transaction active\n"); + return; + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Rolling back transaction on %p\n", - pg->conn); + "Rolling back transaction\n"); GNUNET_break (GNUNET_OK == GNUNET_PQ_exec_statements (pg->conn, es)); @@ -4260,6 +4267,10 @@ postgres_commit (void *cls) }; enum GNUNET_DB_QueryStatus qs; + GNUNET_break (NULL != pg->transaction_name); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Committing transaction `%s'\n", + pg->transaction_name); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "do_commit", params); |