more aggressive rollback on failures

This commit is contained in:
Christian Grothoff 2021-12-08 16:11:27 +01:00
parent 54177c6e1d
commit b64f718037
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -163,9 +163,11 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
return GNUNET_SYSERR; return GNUNET_SYSERR;
if (0 <= qs) if (0 <= qs)
{
qs = TEH_plugin->commit (TEH_plugin->cls); qs = TEH_plugin->commit (TEH_plugin->cls);
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{ {
TEH_plugin->rollback (TEH_plugin->cls);
if (NULL != mhd_ret) if (NULL != mhd_ret)
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
@ -173,6 +175,9 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
NULL); NULL);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (0 > qs)
TEH_plugin->rollback (TEH_plugin->cls);
}
/* make sure callback did not violate invariants! */ /* make sure callback did not violate invariants! */
GNUNET_assert ( (NULL == mhd_ret) || GNUNET_assert ( (NULL == mhd_ret) ||
(-1 == (int) *mhd_ret) ); (-1 == (int) *mhd_ret) );