[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix reconnect commit statement p
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix reconnect commit statement problem |
Date: |
Tue, 02 Jan 2024 13:30:35 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new c92a3892 fix reconnect commit statement problem
c92a3892 is described below
commit c92a38927231949b4f5b9a133c6934b04031339c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Jan 2 13:30:29 2024 +0100
fix reconnect commit statement problem
---
contrib/wallet-core | 2 +-
doc/prebuilt | 2 +-
src/backenddb/pg_delete_otp.c | 1 -
src/backenddb/pg_helper.c | 23 ++++++++++++++++++++---
src/backenddb/plugin_merchantdb_postgres.c | 11 +++--------
src/include/taler_merchantdb_plugin.h | 27 +++++++++++++++------------
6 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/contrib/wallet-core b/contrib/wallet-core
index 2347be69..0c211082 160000
--- a/contrib/wallet-core
+++ b/contrib/wallet-core
@@ -1 +1 @@
-Subproject commit 2347be694c713959528ad59f3f157d866d7ad424
+Subproject commit 0c211082e0b8372f8fa1cef8102e477c7363d9ba
diff --git a/doc/prebuilt b/doc/prebuilt
index 09a33a50..5e47a72e 160000
--- a/doc/prebuilt
+++ b/doc/prebuilt
@@ -1 +1 @@
-Subproject commit 09a33a50d9b3b400f8a515082c888918cbf4e1b5
+Subproject commit 5e47a72e8a2b5086dfdae4078f695155f5ed7af8
diff --git a/src/backenddb/pg_delete_otp.c b/src/backenddb/pg_delete_otp.c
index 7d32b3fb..b4c0687d 100644
--- a/src/backenddb/pg_delete_otp.c
+++ b/src/backenddb/pg_delete_otp.c
@@ -52,4 +52,3 @@ TMH_PG_delete_otp (void *cls,
"delete_otp",
params);
}
-
diff --git a/src/backenddb/pg_helper.c b/src/backenddb/pg_helper.c
index 2ac047b1..802abc21 100644
--- a/src/backenddb/pg_helper.c
+++ b/src/backenddb/pg_helper.c
@@ -38,6 +38,7 @@ TMH_PG_start (void *cls,
GNUNET_PQ_EXECUTE_STATEMENT_END
};
+ GNUNET_assert (NULL != name);
check_connection (pg);
postgres_preflight (pg);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -66,6 +67,7 @@ TMH_PG_start_read_committed (void *cls,
GNUNET_PQ_EXECUTE_STATEMENT_END
};
+ GNUNET_assert (NULL != name);
check_connection (pg);
postgres_preflight (pg);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -93,6 +95,8 @@ TMH_PG_rollback (void *cls)
GNUNET_PQ_EXECUTE_STATEMENT_END
};
+ if (NULL == pg->transaction_name)
+ return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Rolling back merchant DB transaction `%s'\n",
pg->transaction_name);
@@ -110,12 +114,25 @@ TMH_PG_commit (void *cls)
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_end
};
+ enum GNUNET_DB_QueryStatus qs;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Committing merchant DB transaction %s\n",
pg->transaction_name);
+ check_connection (pg);
+ PREPARE (pg,
+ "merchant_commit",
+ "COMMIT");
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "merchant_commit",
+ params);
+ if (qs < 0)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Failed to commit transaction\n");
+ TMH_PG_rollback (pg);
+ return qs;
+ }
pg->transaction_name = NULL;
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "end_transaction",
- params);
+ return qs;
}
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 38dd636e..30f5c169 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -300,21 +300,17 @@ check_connection (struct PostgresClosure *pg)
GNUNET_PQ_reconnect_if_down (pg->conn);
}
+
/**
* Establish connection to the database.
*
* @param cls plugin context
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
-static int
+static enum GNUNET_GenericReturnValue
postgres_connect (void *cls)
{
struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_PreparedStatement ps[] = {
- GNUNET_PQ_make_prepare ("end_transaction",
- "COMMIT"),
- GNUNET_PQ_PREPARED_STATEMENT_END
- };
struct GNUNET_PQ_ExecuteStatement es[] = {
GNUNET_PQ_make_try_execute ("SET search_path TO merchant;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
@@ -324,7 +320,7 @@ postgres_connect (void *cls)
"merchantdb-postgres",
NULL,
es,
- ps);
+ NULL);
pg->prep_gen++;
if (NULL == pg->conn)
return GNUNET_SYSERR;
@@ -618,7 +614,6 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
= &TMH_PG_update_token_family;
-
return plugin;
}
diff --git a/src/include/taler_merchantdb_plugin.h
b/src/include/taler_merchantdb_plugin.h
index 8df171fe..27950232 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1101,12 +1101,13 @@ enum TALER_MERCHANTDB_TokenFamilyKind
* @param expiration end time of the token family's validity period
*/
typedef void
-(*TALER_MERCHANTDB_TokenFamiliesCallback)(void *cls,
- const char *slug,
- const char *name,
- struct GNUNET_TIME_Timestamp
start_time,
- struct GNUNET_TIME_Timestamp
expiration,
- const char *kind);
+(*TALER_MERCHANTDB_TokenFamiliesCallback)(
+ void *cls,
+ const char *slug,
+ const char *name,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp expiration,
+ const char *kind);
/**
@@ -1117,17 +1118,17 @@ struct TALER_MERCHANTDB_TokenFamilyDetails
/**
* Token family slug used for identification.
*/
- char* slug;
+ char *slug;
/**
* User readable name of the token family.
*/
- char* name;
+ char *name;
/**
* Description of the token family.
*/
- char* description;
+ char *description;
/**
* Internationalized token family description.
@@ -1356,7 +1357,7 @@ struct TALER_MERCHANTDB_Plugin
* Commit the current transaction of a database connection.
*
* @param cls the `struct PostgresClosure` with the plugin-specific state
- * @return transaction status code
+ * @return transation status
*/
enum GNUNET_DB_QueryStatus
(*commit)(void *cls);
@@ -3623,7 +3624,8 @@ struct TALER_MERCHANTDB_Plugin
(*update_token_family)(void *cls,
const char *instance_id,
const char *token_family_slug,
- const struct TALER_MERCHANTDB_TokenFamilyDetails
*details);
+ const struct
+ TALER_MERCHANTDB_TokenFamilyDetails *details);
/**
@@ -3639,7 +3641,8 @@ struct TALER_MERCHANTDB_Plugin
(*insert_token_family)(void *cls,
const char *instance_id,
const char *token_family_slug,
- const struct TALER_MERCHANTDB_TokenFamilyDetails
*details);
+ const struct
+ TALER_MERCHANTDB_TokenFamilyDetails *details);
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: fix reconnect commit statement problem,
gnunet <=