commit 767ef1d06b2de26559d370bd26d398bedc18f554
parent 12b8220f543ca16c3827e2fd63fd6ae1b3b72222
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 13 Aug 2026 20:12:52 +0200
fix progress tracking in sanctions checker
Diffstat:
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/exchange/taler-exchange-sanctionscheck.c b/src/exchange/taler-exchange-sanctionscheck.c
@@ -120,11 +120,19 @@ static struct Account *acc_head;
static struct Account *acc_tail;
/**
- * Minimum row ID to process records from.
+ * Minimum row ID to process records from. This is the value we persist,
+ * and it is only advanced once the transaction that evaluated the
+ * respective rows was committed.
*/
static uint64_t min_row_id;
/**
+ * Highest row ID evaluated in the current transaction. Folded into
+ * #min_row_id when that transaction commits.
+ */
+static uint64_t max_row_id;
+
+/**
* File descriptor with the name of the file where we track our
* progress.
*/
@@ -387,7 +395,9 @@ sanction_cb (void *cls,
acc_tail,
acc);
json_decref (acc->properties);
- min_row_id = acc->row_id;
+ /* Evaluations complete out of order, so keep the highest row we did. */
+ max_row_id = GNUNET_MAX (max_row_id,
+ acc->row_id);
GNUNET_free (acc);
if (NULL != acc_head)
return; /* more work */
@@ -405,6 +415,8 @@ sanction_cb (void *cls,
}
}
in_transaction = false;
+ /* Our writes are durable now, so the resume point may move. */
+ min_row_id = max_row_id;
sync_row ();
if (restart_now)
{
@@ -568,6 +580,7 @@ begin_transaction ()
enum GNUNET_DB_QueryStatus qs;
restart_now = false;
+ max_row_id = min_row_id;
GNUNET_assert (! in_transaction);
if (GNUNET_OK !=
TALER_EXCHANGEDB_start (pg,