From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Nov 2026 17:41:26 +0100 Subject: [PATCH] sync: do not assert that two reconcile passes see the same blocks The counting pass and the hashing pass are separate transactions, so the block set can change in between. Issue: https://bugs.taler.net/n/12211 Assisted by LLM --- src/sync/sync-httpd2_get-backups-KEY-blocks-reconcile.c | 8 ++++++-- src/syncdb/syncdb_lookup_block_hashes_TR.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sync/sync-httpd2_get-backups-KEY-blocks-reconcile.c b/src/sync/sync-httpd2_get-backups-KEY-blocks-reconcile.c index 65c7868..f440d38 100644 --- a/src/sync/sync-httpd2_get-backups-KEY-blocks-reconcile.c +++ b/src/sync/sync-httpd2_get-backups-KEY-blocks-reconcile.c @@ -210,8 +210,12 @@ SH_backup_blocks_reconcile_get (struct MHD_Request *request, TALER_EC_GENERIC_DB_FETCH_FAILED, NULL); } - GNUNET_assert (qs == (enum SYNC_DB_QueryStatus) total_blocks); - GNUNET_assert (rhc.count == total_blocks); + /* The two passes are separate transactions: another daemon + process or the garbage collector may have changed the block set + in between. The filter was sized from the first count; report + what was actually hashed into it. */ + GNUNET_break (qs == (enum SYNC_DB_QueryStatus) rhc.count); + total_blocks = rhc.count; } /* Serialize (network byte order) and base32-encode. */ diff --git a/src/syncdb/syncdb_lookup_block_hashes_TR.c b/src/syncdb/syncdb_lookup_block_hashes_TR.c index 93566d4..693f40b 100644 --- a/src/syncdb/syncdb_lookup_block_hashes_TR.c +++ b/src/syncdb/syncdb_lookup_block_hashes_TR.c @@ -164,6 +164,9 @@ SYNCDB_lookup_block_hashes_TR ( default: break; } + /* a row that could not be extracted must not yield a partial count */ + if (hic.qs < 0) + return hic.qs; /* map the flags of the (single) status row to SYNC_DB codes */ if (hic.out_account_missing) return SYNC_DB_PAYMENT_REQUIRED; -- 2.47.3