summaryrefslogtreecommitdiff
path: root/src/exchange-tools
diff options
context:
space:
mode:
authorMarco Boss <bossm8@bfh.ch>2022-03-02 10:50:51 +0100
committerMarco Boss <bossm8@bfh.ch>2022-03-02 10:50:51 +0100
commit2abe9bf6d7df83f480514dce06005a813503982c (patch)
tree14ad79a8f264c7cf75fe1a0a9a1fd0eed94ac260 /src/exchange-tools
parent4978b1e966af48a18cac86aa224b3c266a9531d7 (diff)
downloadexchange-2abe9bf6d7df83f480514dce06005a813503982c.tar.gz
exchange-2abe9bf6d7df83f480514dce06005a813503982c.tar.bz2
exchange-2abe9bf6d7df83f480514dce06005a813503982c.zip
include partitioning logic in dbinit
Diffstat (limited to 'src/exchange-tools')
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c
index a5e6a94af..f7c177edc 100644
--- a/src/exchange-tools/taler-exchange-dbinit.c
+++ b/src/exchange-tools/taler-exchange-dbinit.c
@@ -44,6 +44,11 @@ static int clear_shards;
*/
static int gc_db;
+/**
+ * -P option: setup a partitioned database
+ */
+static uint32_t num_partitions;
+
/**
* Main function that will be run.
@@ -90,6 +95,24 @@ run (void *cls,
global_ret = EXIT_NOPERMISSION;
return;
}
+ if (1 <
+ 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");
+ }
+ if (GNUNET_OK != plugin->drop_tables (plugin->cls))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not drop tables after failed partitioning, please delete the DB manually\n");
+ }
+ TALER_EXCHANGEDB_plugin_unload (plugin);
+ plugin = NULL;
+ global_ret = EXIT_NOTINSTALLED;
+ return;
+ }
if (gc_db || clear_shards)
{
if (GNUNET_OK !=
@@ -150,6 +173,11 @@ main (int argc,
"shardunlock",
"unlock all revolving shard locks (use after system crash or shard size change while services are not running)",
&clear_shards),
+ GNUNET_GETOPT_option_uint ('P',
+ "partition",
+ "NUMBER",
+ "Setup a partitioned database where each table which can be partitioned holds NUMBER partitions on a single DB node (NOTE: this is different from sharding)",
+ &num_partitions),
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;