-try to fix wirewatch loop

This commit is contained in:
Christian Grothoff 2022-12-19 15:53:14 +01:00
parent 97f46a01cd
commit 8f33fe5311
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -377,6 +377,8 @@ handle_soft_error (void)
} }
/* Reset to beginning of transaction, and go again /* Reset to beginning of transaction, and go again
from there. */ from there. */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Encountered soft error, resetting start point to batch start\n");
latest_row_off = batch_start; latest_row_off = batch_start;
GNUNET_assert (NULL == task); GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&continue_with_shard, task = GNUNET_SCHEDULER_add_now (&continue_with_shard,
@ -595,6 +597,7 @@ process_reply (const struct TALER_BANK_CreditDetails *details,
break; break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
/* normal case */ /* normal case */
progress = true;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Completed shard %s (%llu,%llu] after %s\n", "Completed shard %s (%llu,%llu] after %s\n",
job_name, job_name,
@ -606,31 +609,40 @@ process_reply (const struct TALER_BANK_CreditDetails *details,
break; break;
} }
} }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, if (! progress)
"Committing %s progress (%llu,%llu] at %llu\n (%s)", {
job_name, db_plugin->rollback (db_plugin->cls);
(unsigned long long) shard_start, }
(unsigned long long) shard_end, else
(unsigned long long) latest_row_off, {
shard_done GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Committing %s progress (%llu,%llu] at %llu\n (%s)",
job_name,
(unsigned long long) shard_start,
(unsigned long long) shard_end,
(unsigned long long) latest_row_off,
shard_done
? "shard done" ? "shard done"
: "shard incomplete"); : "shard incomplete");
qs = db_plugin->commit (db_plugin->cls); qs = db_plugin->commit (db_plugin->cls);
switch (qs) switch (qs)
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
/* reduce transaction size to reduce rollback probability */ /* reduce transaction size to reduce rollback probability */
handle_soft_error (); GNUNET_log (GNUNET_ERROR_TYPE_INFO,
return; "Got DB soft error on commit. Reducing transaction size.\n");
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: handle_soft_error ();
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: return;
started_transaction = false; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
/* normal case */ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break; started_transaction = false;
/* normal case */
break;
}
} }
if (shard_done) if (shard_done)
{ {