diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-07-25 19:53:31 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-07-25 19:53:31 +0200 |
commit | de83b055d5c4bdbdebdc972e822ec9a4f5604bea (patch) | |
tree | 27ebf423a56d0c16f9bc17122d2b27e6be1ab912 /src/exchange-tools | |
parent | 40858f0952adb1a476010d509cd2cf62e33077a6 (diff) |
-simplify table drop logic
Diffstat (limited to 'src/exchange-tools')
-rw-r--r-- | src/exchange-tools/taler-exchange-dbinit.c | 35 |
1 files changed, 6 insertions, 29 deletions
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 @@ -65,11 +65,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. * * @param cls closure @@ -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 <N> 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", |