From 5149af93147c54055d99af688993de3fb4c36ddf Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 3 Sep 2021 19:08:02 +0200 Subject: preliminary work on supporting sharding/parallel aggregation (undertested, but tests pass again) --- src/exchange-tools/taler-exchange-dbinit.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/exchange-tools/taler-exchange-dbinit.c') 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 @@ -33,6 +34,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 */ @@ -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; -- cgit v1.2.3