gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -debugging batch reserves_in not


From: gnunet
Subject: [taler-exchange] branch master updated: -debugging batch reserves_in notification logic: success: pg_notify does not work, identifier vs. string
Date: Sun, 05 Feb 2023 21:59:43 +0100

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 6d3efbe9 -debugging batch reserves_in notification logic: success: 
pg_notify does not work, identifier vs. string
6d3efbe9 is described below

commit 6d3efbe900ed47f2ce501d795bf4a0dd186d1b91
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 5 21:59:41 2023 +0100

    -debugging batch reserves_in notification logic: success: pg_notify does 
not work, identifier vs. string
---
 src/exchangedb/0002-reserves_in.sql                |  2 +-
 .../exchange_do_batch2_reserves_in_insert.sql      | 10 +++----
 .../exchange_do_batch4_reserves_in_insert.sql      | 17 +++++------
 .../exchange_do_batch8_reserves_in_insert.sql      | 33 +++++++++++-----------
 .../exchange_do_batch_reserves_in_insert.sql       | 17 ++++++-----
 src/exchangedb/pg_reserves_in_insert.c             | 20 +++++++++++++
 6 files changed, 62 insertions(+), 37 deletions(-)

diff --git a/src/exchangedb/0002-reserves_in.sql 
b/src/exchangedb/0002-reserves_in.sql
index 71ec3768..410eca7c 100644
--- a/src/exchangedb/0002-reserves_in.sql
+++ b/src/exchangedb/0002-reserves_in.sql
@@ -25,7 +25,7 @@ DECLARE
 BEGIN
   PERFORM create_partitioned_table(
     'CREATE TABLE %I'
-      '(reserve_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' 
+      '(reserve_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
       ',reserve_pub BYTEA PRIMARY KEY'
       ',wire_reference INT8 NOT NULL'
       ',credit_val INT8 NOT NULL'
diff --git a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql 
b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
index 932f7d81..af9ea319 100644
--- a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
@@ -21,7 +21,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch2_reserves_insert(
   IN in_credit_val INT8,
   IN in_credit_frac INT4,
   IN in_exchange_account_name VARCHAR,
-  IN in_exectution_date INT8,
+  IN in_execution_date INT8,
   IN in_wire_source_h_payto BYTEA,    ---h_payto
   IN in_payto_uri VARCHAR,
   IN in_reserve_expiration INT8,
@@ -32,7 +32,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch2_reserves_insert(
   IN in2_credit_val INT8,
   IN in2_credit_frac INT4,
   IN in2_exchange_account_name VARCHAR,
-  IN in2_exectution_date INT8,
+  IN in2_execution_date INT8,
   IN in2_wire_source_h_payto BYTEA,    ---h_payto
   IN in2_payto_uri VARCHAR,
   IN in2_reserve_expiration INT8,
@@ -116,6 +116,7 @@ BEGIN
   END LOOP;
   CLOSE curs_reserve_exist;
 
+-- FIXME: must be changed to EXECUTE FORMAT!
   PERFORM pg_notify(in_notify, NULL);
   PERFORM pg_notify(in2_notify, NULL);
 
@@ -136,14 +137,14 @@ BEGIN
     ,in_credit_frac
     ,in_exchange_account_name
     ,in_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in2_reserve_pub
     ,in2_wire_ref
     ,in2_credit_val
     ,in2_credit_frac
     ,in2_exchange_account_name
     ,in2_wire_source_h_payto
-    ,in_expiration_date)
+    ,in_execution_date)
     ON CONFLICT DO NOTHING
     RETURNING reserve_pub)
   SELECT * FROM reserve_in_exist;
@@ -181,4 +182,3 @@ BEGIN
   CLOSE curs_transaction_exist;
   RETURN;
 END $$;
-
diff --git a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql 
b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
index 603e893c..0d35e121 100644
--- a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
@@ -21,7 +21,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch4_reserves_insert(
   IN in_credit_val INT8,
   IN in_credit_frac INT4,
   IN in_exchange_account_name VARCHAR,
-  IN in_exectution_date INT8,
+  IN in_execution_date INT8,
   IN in_wire_source_h_payto BYTEA,    ---h_payto
   IN in_payto_uri VARCHAR,
   IN in_reserve_expiration INT8,
@@ -34,7 +34,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch4_reserves_insert(
   IN in2_credit_val INT8,
   IN in2_credit_frac INT4,
   IN in2_exchange_account_name VARCHAR,
-  IN in2_exectution_date INT8,
+  IN in2_execution_date INT8,
   IN in2_wire_source_h_payto BYTEA,    ---h_payto
   IN in2_payto_uri VARCHAR,
   IN in2_reserve_expiration INT8,
@@ -43,7 +43,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch4_reserves_insert(
   IN in3_credit_val INT8,
   IN in3_credit_frac INT4,
   IN in3_exchange_account_name VARCHAR,
-  IN in3_exectution_date INT8,
+  IN in3_execution_date INT8,
   IN in3_wire_source_h_payto BYTEA,    ---h_payto
   IN in3_payto_uri VARCHAR,
   IN in3_reserve_expiration INT8,
@@ -52,7 +52,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch4_reserves_insert(
   IN in4_credit_val INT8,
   IN in4_credit_frac INT4,
   IN in4_exchange_account_name VARCHAR,
-  IN in4_exectution_date INT8,
+  IN in4_execution_date INT8,
   IN in4_wire_source_h_payto BYTEA,    ---h_payto
   IN in4_payto_uri VARCHAR,
   IN in4_reserve_expiration INT8,
@@ -196,6 +196,7 @@ BEGIN
   CLOSE curs_reserve_exist;
 
 
+-- FIXME: must be changed to EXECUTE FORMAT!
   PERFORM pg_notify(in_notify, NULL);
   PERFORM pg_notify(in2_notify, NULL);
   PERFORM pg_notify(in3_notify, NULL);
@@ -219,28 +220,28 @@ BEGIN
     ,in_credit_frac
     ,in_exchange_account_name
     ,in_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in2_reserve_pub
     ,in2_wire_ref
     ,in2_credit_val
     ,in2_credit_frac
     ,in2_exchange_account_name
     ,in2_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in3_reserve_pub
     ,in3_wire_ref
     ,in3_credit_val
     ,in3_credit_frac
     ,in3_exchange_account_name
     ,in3_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in4_reserve_pub
     ,in4_wire_ref
     ,in4_credit_val
     ,in4_credit_frac
     ,in4_exchange_account_name
     ,in4_wire_source_h_payto
-    ,in_expiration_date)
+    ,in_execution_date)
      ON CONFLICT DO NOTHING
      RETURNING reserve_pub)
     SELECT * FROM reserve_in_changes;
diff --git a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql 
b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
index 68b9c8fa..8fa5ff5d 100644
--- a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
@@ -21,7 +21,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in_credit_val INT8,
   IN in_credit_frac INT4,
   IN in_exchange_account_name VARCHAR,
-  IN in_exectution_date INT8,
+  IN in_execution_date INT8,
   IN in_wire_source_h_payto BYTEA,    ---h_payto
   IN in_payto_uri VARCHAR,
   IN in_reserve_expiration INT8,
@@ -38,7 +38,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in2_credit_val INT8,
   IN in2_credit_frac INT4,
   IN in2_exchange_account_name VARCHAR,
-  IN in2_exectution_date INT8,
+  IN in2_execution_date INT8,
   IN in2_wire_source_h_payto BYTEA,    ---h_payto
   IN in2_payto_uri VARCHAR,
   IN in2_reserve_expiration INT8,
@@ -47,7 +47,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in3_credit_val INT8,
   IN in3_credit_frac INT4,
   IN in3_exchange_account_name VARCHAR,
-  IN in3_exectution_date INT8,
+  IN in3_execution_date INT8,
   IN in3_wire_source_h_payto BYTEA,    ---h_payto
   IN in3_payto_uri VARCHAR,
   IN in3_reserve_expiration INT8,
@@ -56,7 +56,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in4_credit_val INT8,
   IN in4_credit_frac INT4,
   IN in4_exchange_account_name VARCHAR,
-  IN in4_exectution_date INT8,
+  IN in4_execution_date INT8,
   IN in4_wire_source_h_payto BYTEA,    ---h_payto
   IN in4_payto_uri VARCHAR,
   IN in4_reserve_expiration INT8,
@@ -65,7 +65,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in5_credit_val INT8,
   IN in5_credit_frac INT4,
   IN in5_exchange_account_name VARCHAR,
-  IN in5_exectution_date INT8,
+  IN in5_execution_date INT8,
   IN in5_wire_source_h_payto BYTEA,    ---h_payto
   IN in5_payto_uri VARCHAR,
   IN in5_reserve_expiration INT8,
@@ -74,7 +74,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in6_credit_val INT8,
   IN in6_credit_frac INT4,
   IN in6_exchange_account_name VARCHAR,
-  IN in6_exectution_date INT8,
+  IN in6_execution_date INT8,
   IN in6_wire_source_h_payto BYTEA,    ---h_payto
   IN in6_payto_uri VARCHAR,
   IN in6_reserve_expiration INT8,
@@ -83,7 +83,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in7_credit_val INT8,
   IN in7_credit_frac INT4,
   IN in7_exchange_account_name VARCHAR,
-  IN in7_exectution_date INT8,
+  IN in7_execution_date INT8,
   IN in7_wire_source_h_payto BYTEA,    ---h_payto
   IN in7_payto_uri VARCHAR,
   IN in7_reserve_expiration INT8,
@@ -92,7 +92,7 @@ CREATE OR REPLACE FUNCTION exchange_do_batch8_reserves_insert(
   IN in8_credit_val INT8,
   IN in8_credit_frac INT4,
   IN in8_exchange_account_name VARCHAR,
-  IN in8_exectution_date INT8,
+  IN in8_execution_date INT8,
   IN in8_wire_source_h_payto BYTEA,    ---h_payto
   IN in8_payto_uri VARCHAR,
   IN in8_reserve_expiration INT8,
@@ -369,6 +369,7 @@ BEGIN
 
   CLOSE curs_reserve_existed;
 
+-- FIXME: must be changed to EXECUTE FORMAT!
   PERFORM pg_notify(in_notify, NULL);
   PERFORM pg_notify(in2_notify, NULL);
   PERFORM pg_notify(in3_notify, NULL);
@@ -395,56 +396,56 @@ BEGIN
     ,in_credit_frac
     ,in_exchange_account_name
     ,in_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in2_reserve_pub
     ,in2_wire_ref
     ,in2_credit_val
     ,in2_credit_frac
     ,in2_exchange_account_name
     ,in2_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in3_reserve_pub
     ,in3_wire_ref
     ,in3_credit_val
     ,in3_credit_frac
     ,in3_exchange_account_name
     ,in3_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in4_reserve_pub
     ,in4_wire_ref
     ,in4_credit_val
     ,in4_credit_frac
     ,in4_exchange_account_name
     ,in4_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in5_reserve_pub
     ,in5_wire_ref
     ,in5_credit_val
     ,in5_credit_frac
     ,in5_exchange_account_name
     ,in5_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in6_reserve_pub
     ,in6_wire_ref
     ,in6_credit_val
     ,in6_credit_frac
     ,in6_exchange_account_name
     ,in6_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in7_reserve_pub
     ,in7_wire_ref
     ,in7_credit_val
     ,in7_credit_frac
     ,in7_exchange_account_name
     ,in7_wire_source_h_payto
-    ,in_expiration_date),
+    ,in_execution_date),
     (in8_reserve_pub
     ,in8_wire_ref
     ,in8_credit_val
     ,in8_credit_frac
     ,in8_exchange_account_name
     ,in8_wire_source_h_payto
-    ,in_expiration_date)
+    ,in_execution_date)
      ON CONFLICT DO NOTHING
      RETURNING reserve_pub)
     SELECT * FROM reserve_in_changes;
diff --git a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql 
b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
index 73947b4b..4eec2e00 100644
--- a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
@@ -22,7 +22,7 @@ CREATE OR REPLACE FUNCTION 
exchange_do_batch_reserves_in_insert(
   IN in_credit_val INT8,
   IN in_credit_frac INT4,
   IN in_exchange_account_name VARCHAR,
-  IN in_exectution_date INT8,
+  IN in_execution_date INT8,
   IN in_wire_source_h_payto BYTEA,    ---h_payto
   IN in_payto_uri VARCHAR,
   IN in_reserve_expiration INT8,
@@ -39,10 +39,11 @@ DECLARE
 DECLARE
   curs_trans refcursor;
 BEGIN
-ruuid= 0;
-out_reserve_found = TRUE;
-transaction_duplicate= TRUE;
-  --SIMPLE INSERT ON CONFLICT DO NOTHING
+  ruuid = 0;
+  out_reserve_found = TRUE;
+  transaction_duplicate = TRUE;
+
+--SIMPLE INSERT ON CONFLICT DO NOTHING
   INSERT INTO wire_targets
     (wire_target_h_payto
     ,payto_uri)
@@ -97,7 +98,7 @@ transaction_duplicate= TRUE;
     ,in_credit_frac
     ,in_exchange_account_name
     ,in_wire_source_h_payto
-    ,in_expiration_date)
+    ,in_execution_date)
     ON CONFLICT DO NOTHING
     RETURNING reserve_pub)
   SELECT * FROM reserve_transaction;
@@ -108,7 +109,9 @@ transaction_duplicate= TRUE;
     THEN
     -- HAPPY PATH THERE IS NO DUPLICATE TRANS
        transaction_duplicate = FALSE;
-       PERFORM pg_notify(in_notify, NULL);
+       EXECUTE FORMAT (
+         'NOTIFY %s'
+         ,in_notify);
     END IF;
   END IF;
   CLOSE curs_trans;
diff --git a/src/exchangedb/pg_reserves_in_insert.c 
b/src/exchangedb/pg_reserves_in_insert.c
index 2db7e4a4..ac14cb56 100644
--- a/src/exchangedb/pg_reserves_in_insert.c
+++ b/src/exchangedb/pg_reserves_in_insert.c
@@ -54,6 +54,25 @@ compute_notify_on_reserve (const struct 
TALER_ReservePublicKeyP *reserve_pub)
 }
 
 
+static void
+notify_on_reserve (struct PostgresClosure *pg,
+                   const struct TALER_ReservePublicKeyP *reserve_pub)
+{
+  struct TALER_ReserveEventP rep = {
+    .header.size = htons (sizeof (rep)),
+    .header.type = htons (TALER_DBEVENT_EXCHANGE_RESERVE_INCOMING),
+    .reserve_pub = *reserve_pub
+  };
+
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Notifying on reserve!\n");
+  TEH_PG_event_notify (pg,
+                       &rep.header,
+                       NULL,
+                       0);
+}
+
+
 static enum GNUNET_DB_QueryStatus
 insert1 (struct PostgresClosure *pg,
          const struct TALER_EXCHANGEDB_ReserveInInfo reserves[1],
@@ -689,6 +708,7 @@ TEH_PG_reserves_in_insert (void *cls,
   {
     unsigned int bs = GNUNET_MIN (batch_size,
                                   reserves_length - i);
+    bs = 1; // FIXME-JOSEPH: for now, until pg_notify is gone!
     if (bs >= 8)
     {
       qs1 = insert8 (pg,

-- 
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]