summaryrefslogtreecommitdiff
path: root/src/exchange-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange-tools')
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c
index 9ec31afc1..1aba05a6d 100644
--- a/src/exchange-tools/taler-exchange-dbinit.c
+++ b/src/exchange-tools/taler-exchange-dbinit.c
@@ -49,6 +49,10 @@ static int gc_db;
*/
static uint32_t num_partitions;
+/**
+ * -S option: setup a sharded database
+ */
+static uint32_t num_shards;
/**
* Main function that will be run.
@@ -113,6 +117,24 @@ run (void *cls,
return;
}
}
+ else if (1 <
+ num_shards)
+ {
+ if (GNUNET_OK != plugin->setup_shards (plugin->cls, num_shards))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not setup shards. Aborting\n");
+ if (GNUNET_OK != plugin->drop_tables (plugin->cls))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not drop tables after failed shard setup, 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 !=
@@ -178,6 +200,11 @@ main (int argc,
"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_uint ('S',
+ "shard",
+ "NUMBER",
+ "Setup a sharded database whit N shards",
+ &num_shards),
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;