gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: fix batch size adjustment of wir


From: gnunet
Subject: [taler-exchange] branch master updated: fix batch size adjustment of wirewatcher
Date: Sat, 19 Jun 2021 17:11:13 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 2a9ec82d fix batch size adjustment of wirewatcher
2a9ec82d is described below

commit 2a9ec82dceec4dba2d7b1a5f7d891abb6d2cd5b9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jun 19 17:11:11 2021 +0200

    fix batch size adjustment of wirewatcher
---
 src/benchmark/taler-bank-benchmark.c        |  3 +-
 src/exchange/taler-exchange-wirewatch.c     | 46 ++++++++++++++---------------
 src/exchangedb/plugin_exchangedb_postgres.c |  2 +-
 3 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/src/benchmark/taler-bank-benchmark.c 
b/src/benchmark/taler-bank-benchmark.c
index 6df8e5ae..81e91552 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 480b3ee3..ab2bc381 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 29eedb8f..04dc03cd 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 (

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]