summaryrefslogtreecommitdiff
path: root/src/exchange-tools/taler-exchange-dbinit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-09-03 19:08:02 +0200
committerChristian Grothoff <christian@grothoff.org>2021-09-03 19:08:02 +0200
commit5149af93147c54055d99af688993de3fb4c36ddf (patch)
tree8652e56bed70976309412e11c35305a352576a9b /src/exchange-tools/taler-exchange-dbinit.c
parent6e1877b142d4819a248b01aebfdd6f337f82a509 (diff)
downloadexchange-5149af93147c54055d99af688993de3fb4c36ddf.tar.gz
exchange-5149af93147c54055d99af688993de3fb4c36ddf.tar.bz2
exchange-5149af93147c54055d99af688993de3fb4c36ddf.zip
preliminary work on supporting sharding/parallel aggregation (undertested, but tests pass again)
Diffstat (limited to 'src/exchange-tools/taler-exchange-dbinit.c')
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c
index 63a1ddf9d..5e18549e7 100644
--- a/src/exchange-tools/taler-exchange-dbinit.c
+++ b/src/exchange-tools/taler-exchange-dbinit.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015 Taler Systems SA
+ Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -17,6 +17,7 @@
* @file exchange-tools/taler-exchange-dbinit.c
* @brief Create tables for the exchange database.
* @author Florian Dold
+ * @author Christian Grothoff
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
@@ -34,6 +35,11 @@ static int global_ret;
static int reset_db;
/**
+ * -s option: clear revolving shard locks
+ */
+static int clear_shards;
+
+/**
* -g option: garbage collect DB reset
*/
static int gc_db;
@@ -83,6 +89,14 @@ run (void *cls,
global_ret = EXIT_NOPERMISSION;
return;
}
+ if (clear_shards)
+ {
+ if (0 < plugin->delete_revolving_shards (plugin->cls))
+ {
+ fprintf (stderr,
+ "Clearing revolving shards failed!\n");
+ }
+ }
if (gc_db)
{
if (GNUNET_SYSERR == plugin->gc (plugin->cls))
@@ -108,14 +122,18 @@ main (int argc,
char *const *argv)
{
const struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_flag ('r',
- "reset",
- "reset database (DANGEROUS: all existing data is lost!)",
- &reset_db),
GNUNET_GETOPT_option_flag ('g',
"gc",
"garbage collect database",
&gc_db),
+ GNUNET_GETOPT_option_flag ('r',
+ "reset",
+ "reset database (DANGEROUS: all existing data is lost!)",
+ &reset_db),
+ GNUNET_GETOPT_option_flag ('s',
+ "shardunlock",
+ "unlock all revolving shard locks (use after system crash or shard size change while services are not running)",
+ &clear_shards),
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;