fix for soft fail error handling in wirewatch discovered in #6892, bugnote 17930: bank API calls us one more time after returning SYSERR, and we must in that case not bump the progress point just because a commit succeeds after the rollback

This commit is contained in:
Christian Grothoff 2021-05-29 08:38:33 +02:00
parent 3df47fa6d7
commit 060816eafd
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -111,6 +111,11 @@ struct WireAccount
*/ */
int delay; int delay;
/**
* Did we experience a soft failure during the current
* transaction?
*/
bool soft_fail;
}; };
@ -358,10 +363,20 @@ history_cb (void *cls,
(unsigned int) ec, (unsigned int) ec,
http_status); http_status);
} }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, if (wa->soft_fail)
"End of list. Committing progress!\n"); {
qs = db_plugin->commit (db_plugin->cls, /* no point to commit, transaction was already rolled
session); back after we encountered a soft failure */
wa->soft_fail = false;
qs = GNUNET_DB_STATUS_SOFT_ERROR;
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"End of list. Committing progress!\n");
qs = db_plugin->commit (db_plugin->cls,
session);
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs) if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@ -459,10 +474,7 @@ history_cb (void *cls,
"Got DB soft error for reserves_in_insert. Rolling back.\n"); "Got DB soft error for reserves_in_insert. Rolling back.\n");
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
/* try again */ wa->soft_fail = true;
GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&find_transfers,
NULL);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
wa->delay = GNUNET_NO; wa->delay = GNUNET_NO;