From 2abe9bf6d7df83f480514dce06005a813503982c Mon Sep 17 00:00:00 2001 From: Marco Boss Date: Wed, 2 Mar 2022 10:50:51 +0100 Subject: include partitioning logic in dbinit --- src/include/taler_exchangedb_plugin.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/include/taler_exchangedb_plugin.h') diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 846183ee..8b0100c8 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2232,6 +2232,16 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_GenericReturnValue (*create_tables)(void *cls); + /** + * Change already present tables of the database to more partitions + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param num the number of partitions to create for each partitioned table + * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure + */ + enum GNUNET_GenericReturnValue + (*setup_partitions)(void *cls, + const uint32_t *num); /** * Start a transaction. -- cgit v1.2.3 From cab654237f743fc58e398dd093ee6316c7ce0278 Mon Sep 17 00:00:00 2001 From: Marco Boss Date: Wed, 2 Mar 2022 11:28:28 +0100 Subject: clearer doc --- src/include/taler_exchangedb_plugin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/include/taler_exchangedb_plugin.h') diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 8b0100c8..a3c2e2ca 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2233,7 +2233,8 @@ struct TALER_EXCHANGEDB_Plugin (*create_tables)(void *cls); /** - * Change already present tables of the database to more partitions + * Change already present tables of the database to num partitions + * Only has an effect if there are default partitions only * * @param cls the @e cls of this struct with the plugin-specific state * @param num the number of partitions to create for each partitioned table -- cgit v1.2.3 From 7f30609ff0773873df9274bf4a491dd00e623577 Mon Sep 17 00:00:00 2001 From: Marco Boss Date: Wed, 2 Mar 2022 17:22:43 +0100 Subject: use plain uint32_t --- src/exchange-tools/taler-exchange-dbinit.c | 2 +- src/exchangedb/plugin_exchangedb_postgres.c | 4 ++-- src/include/taler_exchangedb_plugin.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/include/taler_exchangedb_plugin.h') diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c index 69b9d1a1..9ec31afc 100644 --- a/src/exchange-tools/taler-exchange-dbinit.c +++ b/src/exchange-tools/taler-exchange-dbinit.c @@ -98,7 +98,7 @@ run (void *cls, if (1 < num_partitions) { - if (GNUNET_OK != plugin->setup_partitions (plugin->cls, &num_partitions)) + if (GNUNET_OK != plugin->setup_partitions (plugin->cls, num_partitions)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not setup partitions. Dropping default ones again\n"); diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 517792b9..b397728b 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -207,13 +207,13 @@ postgres_create_tables (void *cls) */ static enum GNUNET_GenericReturnValue postgres_setup_partitions (void *cls, - const uint32_t *num) + const uint32_t num) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_Context *conn; enum GNUNET_GenericReturnValue ret; struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint32 (num), + GNUNET_PQ_query_param_uint32 (&num), GNUNET_PQ_query_param_end }; struct GNUNET_PQ_PreparedStatement ps[] = { diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index a3c2e2ca..9841d45d 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2242,7 +2242,7 @@ struct TALER_EXCHANGEDB_Plugin */ enum GNUNET_GenericReturnValue (*setup_partitions)(void *cls, - const uint32_t *num); + const uint32_t num); /** * Start a transaction. -- cgit v1.2.3