summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-07 15:59:35 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-07 15:59:35 +0200
commitf0bcbf65862c8e44e245bda21ea078803dcd5ad0 (patch)
tree1ba0b19ced8dfe8b024926dd4f37a910cc25c803 /src/exchangedb/plugin_exchangedb_postgres.c
parentb9a30d29cb91ec66c3bb8d956640d20e641b6a4d (diff)
downloadexchange-f0bcbf65862c8e44e245bda21ea078803dcd5ad0.tar.gz
exchange-f0bcbf65862c8e44e245bda21ea078803dcd5ad0.tar.bz2
exchange-f0bcbf65862c8e44e245bda21ea078803dcd5ad0.zip
allow double-rollback, warn on rollback+commit
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c15
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);