[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-exchange] 05/07: make wirewatch properly handle (sof
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-exchange] 05/07: make wirewatch properly handle (soft) failed transations |
Date: |
Sat, 11 Aug 2018 11:43:38 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit 1ee55ea838a2b98b54a28a5f6b426496e2e36b89
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Aug 11 10:55:50 2018 +0200
make wirewatch properly handle (soft) failed transations
---
src/exchange/taler-exchange-wirewatch.c | 56 ++++++++++++++++++++++-------
src/exchangedb/plugin_exchangedb_postgres.c | 2 +-
2 files changed, 44 insertions(+), 14 deletions(-)
diff --git a/src/exchange/taler-exchange-wirewatch.c
b/src/exchange/taler-exchange-wirewatch.c
index 9de0597..bfdf052 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -140,6 +140,17 @@ static void *last_row_off;
static size_t last_row_off_size;
/**
+ * Latest row offset seen in this transaction, becomes
+ * the new #last_row_off upon commit.
+ */
+static void *latest_row_off;
+
+/**
+ * Number of bytes in #latest_row_off.
+ */
+static size_t latest_row_off_size;
+
+/**
* Should we delay the next request to the wire plugin a bit?
*/
static int delay;
@@ -389,6 +400,28 @@ history_cb (void *cls,
"End of list. Committing progress!\n");
qs = db_plugin->commit (db_plugin->cls,
session);
+ if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Got DB soft error for commit\n");
+ /* do we need to rollback explicitly on commit failure!? */
+ db_plugin->rollback (db_plugin->cls,
+ session);
+ /* try again */
+ GNUNET_assert (NULL == task);
+ task = GNUNET_SCHEDULER_add_now (&find_transfers,
+ NULL);
+ return GNUNET_OK; /* will be ignored anyway */
+ }
+ if (0 < qs)
+ {
+ /* transaction success, update #last_row_off */
+ GNUNET_free_non_null (last_row_off);
+ last_row_off = latest_row_off;
+ last_row_off_size = latest_row_off_size;
+ latest_row_off = NULL;
+ latest_row_off_size = 0;
+ }
GNUNET_break (0 <= qs);
if ( (GNUNET_YES == delay) &&
(test_mode) &&
@@ -403,9 +436,6 @@ history_cb (void *cls,
{
wa_pos->delayed_until
= GNUNET_TIME_relative_to_absolute (DELAY);
- GNUNET_free_non_null (last_row_off);
- last_row_off = NULL;
- last_row_off_size = 0;
wa_pos = wa_pos->next;
if (NULL == wa_pos)
wa_pos = wa_head;
@@ -425,13 +455,13 @@ history_cb (void *cls,
TALER_amount2s (&details->amount),
details->wtid_s);
GNUNET_break (0 != row_off_size);
- if (last_row_off_size != row_off_size)
+ if (latest_row_off_size != row_off_size)
{
- GNUNET_free_non_null (last_row_off);
- last_row_off = GNUNET_malloc (row_off_size);
- last_row_off_size = row_off_size;
+ GNUNET_free_non_null (latest_row_off);
+ latest_row_off = GNUNET_malloc (row_off_size);
+ latest_row_off_size = row_off_size;
}
- memcpy (last_row_off,
+ memcpy (latest_row_off,
row_off,
row_off_size);
rtc = GNUNET_new (struct RejectContext);
@@ -492,13 +522,13 @@ history_cb (void *cls,
return GNUNET_SYSERR;
}
- if (last_row_off_size != row_off_size)
+ if (latest_row_off_size != row_off_size)
{
- GNUNET_free_non_null (last_row_off);
- last_row_off = GNUNET_malloc (row_off_size);
- last_row_off_size = row_off_size;
+ GNUNET_free_non_null (latest_row_off);
+ latest_row_off = GNUNET_malloc (row_off_size);
+ latest_row_off_size = row_off_size;
}
- memcpy (last_row_off,
+ memcpy (latest_row_off,
row_off,
row_off_size);
return GNUNET_OK;
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c
b/src/exchangedb/plugin_exchangedb_postgres.c
index 02ab5d7..724bf28 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -2062,7 +2062,7 @@ postgres_reserves_in_insert (void *cls,
&reserve);
if (0 > reserve_exists)
{
- GNUNET_break (0);
+ GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == reserve_exists);
return reserve_exists;
}
if ( (0 == reserve.balance.value) &&
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-exchange] branch master updated (18736c4 -> a1f2895), gnunet, 2018/08/11
- [GNUnet-SVN] [taler-exchange] 04/07: be aggressive, gnunet, 2018/08/11
- [GNUnet-SVN] [taler-exchange] 03/07: leave it to GNUnet, gnunet, 2018/08/11
- [GNUnet-SVN] [taler-exchange] 02/07: disable SECMEM for Taler exchange, it causes massive lock contention and then scalability issues, gnunet, 2018/08/11
- [GNUnet-SVN] [taler-exchange] 07/07: make wirewatch batch size adaptive to transaction success/failure, gnunet, 2018/08/11
- [GNUnet-SVN] [taler-exchange] 01/07: cache result from log level check, gnunet, 2018/08/11
- [GNUnet-SVN] [taler-exchange] 05/07: make wirewatch properly handle (soft) failed transations,
gnunet <=
- [GNUnet-SVN] [taler-exchange] 06/07: implement retries for a few more commands, gnunet, 2018/08/11