summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-06-19 17:11:11 +0200
committerChristian Grothoff <christian@grothoff.org>2021-06-19 17:11:11 +0200
commit2a9ec82dceec4dba2d7b1a5f7d891abb6d2cd5b9 (patch)
treebbb4be903038469135cf6bd6f0c13d0a1dbd719c
parentbbe86aee788df49b52601e264f517519a24841a8 (diff)
downloadexchange-2a9ec82dceec4dba2d7b1a5f7d891abb6d2cd5b9.tar.gz
exchange-2a9ec82dceec4dba2d7b1a5f7d891abb6d2cd5b9.tar.bz2
exchange-2a9ec82dceec4dba2d7b1a5f7d891abb6d2cd5b9.zip
fix batch size adjustment of wirewatcher
-rw-r--r--src/benchmark/taler-bank-benchmark.c3
-rw-r--r--src/exchange/taler-exchange-wirewatch.c46
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c2
3 files changed, 25 insertions, 26 deletions
diff --git a/src/benchmark/taler-bank-benchmark.c b/src/benchmark/taler-bank-benchmark.c
index 6df8e5aef..81e915524 100644
--- a/src/benchmark/taler-bank-benchmark.c
+++ b/src/benchmark/taler-bank-benchmark.c
@@ -25,7 +25,6 @@
// TODO:
// - use more than one 'client' bank account
// - also add taler-exchange-transfer to simulate outgoing payments
-// - improve reporting logic (currently not working)
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <microhttpd.h>
@@ -516,7 +515,7 @@ parallel_benchmark (void)
return GNUNET_SYSERR;
}
/* wait for fakebank to be ready */
- sleep (1);
+ sleep (1 + history_size / 65536);
}
else
{
diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c
index 480b3ee36..ab2bc3812 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -377,31 +377,39 @@ history_cb (void *cls,
qs = db_plugin->commit (db_plugin->cls,
session);
}
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_SCHEDULER_shutdown ();
+ return GNUNET_OK;
+ }
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got DB soft error for commit\n");
/* reduce transaction size to reduce rollback probability */
- if (2 > wa->current_batch_size)
- wa->current_batch_size /= 2;
+ if (2 > wa->batch_size)
+ {
+ wa->batch_size /= 2;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Reduced batch size to %llu due to serialization issue\n",
+ (unsigned long long) wa->batch_size);
+ }
/* try again */
GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&find_transfers,
NULL);
return GNUNET_OK; /* will be ignored anyway */
}
- if (0 < qs)
+ GNUNET_break (0 <= qs);
+ /* transaction success, update #last_row_off */
+ wa->last_row_off = wa->latest_row_off;
+ wa->latest_row_off = 0; /* should not be needed */
+ wa->session = NULL; /* should not be needed */
+ if (wa->batch_size < INITIAL_BATCH_SIZE)
{
- /* transaction success, update #last_row_off */
- wa->last_row_off = wa->latest_row_off;
- wa->latest_row_off = 0; /* should not be needed */
- wa->session = NULL; /* should not be needed */
- /* if successful at limit, try increasing transaction batch size (AIMD) */
- if ( (wa->current_batch_size == wa->batch_size) &&
- (UINT_MAX > wa->batch_size) )
- wa->batch_size++;
+ wa->batch_size += 1;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Increasing batch size to %llu\n",
+ (unsigned long long) wa->batch_size);
}
- GNUNET_break (0 <= qs);
if ( (GNUNET_YES == wa->delay) &&
(test_mode) &&
(NULL == wa->next) )
@@ -425,7 +433,7 @@ history_cb (void *cls,
NULL);
return GNUNET_OK; /* will be ignored anyway */
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding wire transfer over %s with (hashed) subject `%s'\n",
TALER_amount2s (&details->amount),
TALER_B2S (&details->reserve_pub));
@@ -450,8 +458,6 @@ history_cb (void *cls,
}
#endif
- if (wa->current_batch_size < UINT_MAX)
- wa->current_batch_size++;
qs = db_plugin->reserves_in_insert (db_plugin->cls,
session,
&details->reserve_pub,
@@ -496,8 +502,6 @@ find_transfers (void *cls)
(void) cls;
task = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Checking for incoming wire transfers\n");
if (NULL == (session = db_plugin->get_session (db_plugin->cls)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -548,10 +552,6 @@ find_transfers (void *cls)
}
wa_pos->delay = GNUNET_YES;
wa_pos->current_batch_size = 0; /* reset counter */
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "wirewatch: requesting incoming history from %s\n",
- wa_pos->auth.wire_gateway_url);
wa_pos->session = session;
wa_pos->hh = TALER_BANK_credit_history (ctx,
&wa_pos->auth,
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 29eedb8f4..04dc03cdd 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -3411,7 +3411,7 @@ postgres_reserves_in_insert (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == reserve_exists);
return reserve_exists;
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating reserve %s with expiration in %s\n",
TALER_B2S (reserve_pub),
GNUNET_STRINGS_relative_time_to_string (