From de83b055d5c4bdbdebdc972e822ec9a4f5604bea Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 25 Jul 2022 19:53:31 +0200 Subject: -simplify table drop logic --- src/exchange-tools/taler-exchange-dbinit.c | 35 +++++------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'src/exchange-tools') diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c index 28850c016..8746d3e58 100644 --- a/src/exchange-tools/taler-exchange-dbinit.c +++ b/src/exchange-tools/taler-exchange-dbinit.c @@ -64,11 +64,6 @@ static int force_create_partitions; */ static uint32_t shard_idx; -/** - * -R option: do full shard DB reset - */ -static uint32_t reset_shard_db; - /** * Main function that will be run. * @@ -98,31 +93,18 @@ run (void *cls, } if (reset_db) { - if (GNUNET_OK != plugin->drop_tables (plugin->cls)) + if (GNUNET_OK != + plugin->drop_tables (plugin->cls)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not drop tables as requested. Either database was not yet initialized, or permission denied. Consult the logs. Will still try to create new tables.\n"); } } - if (0 < - reset_shard_db) - { - if (GNUNET_OK != plugin->drop_shard_tables (plugin->cls, reset_shard_db)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not drop shard tables as requested. Either database was not yet initialized or permission denied. Consult the logs.\n"); - global_ret = EXIT_FAILURE; - return; - } - GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, - "Dropped shard database, please call taler-exchange-dbinit -S to initialize a new shard database\n"); - return; - } - if (0 < - shard_idx) + if (0 < shard_idx) { - if (GNUNET_OK != plugin->create_shard_tables (plugin->cls, - shard_idx)) + if (GNUNET_OK != + plugin->create_shard_tables (plugin->cls, + shard_idx)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not create shard database\n"); @@ -249,11 +231,6 @@ main (int argc, "INDEX", "Setup a shard server, creates tables with INDEX as suffix", &shard_idx), - GNUNET_GETOPT_option_uint ('R', - "reset-shard", - "OLD_SHARD_IDX", - "reset a shard database, does not reinitialize i.e. call taler-exchange-dbinit -S afterwards (DANGEROUS: all existing data is lost!)", - &reset_shard_db), GNUNET_GETOPT_option_flag ('f', "force", "Force partitions to be created if there is only one partition", -- cgit v1.2.3