commit 04e6e2b4a3fd6934b44a4f75d4775508d6cbabc3
parent 2bf5157466087731e1fef97e76eb8d0b03835ea1
Author: Florian Dold <dold@taler.net>
Date: Tue, 8 Sep 2026 16:54:17 +0200
dbinit: keep garbage collection separate from schema upgrades
Diffstat:
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c
@@ -99,7 +99,11 @@ run (void *cls,
(void) cls;
(void) args;
(void) cfgfile;
- pg = TALER_EXCHANGEDB_connect_admin (cfg);
+ /* An explicit reset retains its initialization behavior, even with -g.
+ Scheduled GC must only connect to an already current schema. */
+ pg = (gc_db && ! reset_db)
+ ? TALER_EXCHANGEDB_connect (cfg)
+ : TALER_EXCHANGEDB_connect_admin (cfg);
if (NULL == pg)
{
fprintf (stderr,
@@ -116,11 +120,12 @@ run (void *cls,
"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 (GNUNET_OK !=
- TALER_EXCHANGEDB_create_tables (pg,
- force_create_partitions ||
- (num_partitions > 0),
- num_partitions))
+ if ( ((! gc_db) || reset_db) &&
+ (GNUNET_OK !=
+ TALER_EXCHANGEDB_create_tables (pg,
+ force_create_partitions ||
+ (num_partitions > 0),
+ num_partitions)) )
{
fprintf (stderr,
"Failed to initialize database.\n");
@@ -136,6 +141,7 @@ run (void *cls,
{
fprintf (stderr,
"Clearing revolving shards failed!\n");
+ global_ret = EXIT_FAILURE;
}
}
if (gc_db)
@@ -145,6 +151,7 @@ run (void *cls,
{
fprintf (stderr,
"Garbage collection failed!\n");
+ global_ret = EXIT_FAILURE;
}
}
}