diff options
author | Marco Boss <bossm8@bfh.ch> | 2022-03-02 19:03:54 +0100 |
---|---|---|
committer | Marco Boss <bossm8@bfh.ch> | 2022-03-02 19:03:54 +0100 |
commit | 57e3864c095f7ac7ca2fe5744a7ec05feb7d56be (patch) | |
tree | bf58c563f59389902fc95fac227122dbb099e3fc /src/exchange-tools | |
parent | 10d7d93ad8002b0ea70899d8cdb503b91ce20d74 (diff) | |
parent | 79d123d1b4a39e69cfbcb3820e71e805a623b8ad (diff) | |
download | exchange-57e3864c095f7ac7ca2fe5744a7ec05feb7d56be.tar.xz |
Include partitioning in dbinit
Diffstat (limited to 'src/exchange-tools')
-rw-r--r-- | src/exchange-tools/taler-exchange-dbinit.c | 28 |
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..9ec31afc1 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; |