[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: try batch1 with cursor
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: try batch1 with cursor |
Date: |
Fri, 06 Jan 2023 17:15:36 +0100 |
This is an automated email from the git hooks/post-receive script.
joseph-xu pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 28c3ae47 try batch1 with cursor
28c3ae47 is described below
commit 28c3ae47de7428b4f7019db9158390f8d14ca93d
Author: Joseph <Joseph.xu@efrei.net>
AuthorDate: Fri Jan 6 11:15:32 2023 -0500
try batch1 with cursor
---
.../exchange_do_batch_reserves_in_insert.sql | 20 +++++++++++++-------
src/exchangedb/pg_batch2_reserves_in_insert.c | 2 +-
src/exchangedb/test_exchangedb_by_j.c | 2 +-
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
index d1cc35d3..c95f75c3 100644
--- a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
@@ -36,6 +36,8 @@ DECLARE
curs refcursor;
DECLARE
i RECORD;
+DECLARE
+ curs_trans refcursor;
BEGIN
ruuid= 0;
out_reserve_found = TRUE;
@@ -79,6 +81,8 @@ transaction_duplicate= TRUE;
CLOSE curs;
PERFORM pg_notify(in_notify, NULL);
+ OPEN curs_trans FOR
+ WITH reserve_transaction AS(
INSERT INTO reserves_in
(reserve_pub
,wire_reference
@@ -95,16 +99,18 @@ transaction_duplicate= TRUE;
,in_exchange_account_name
,in_wire_source_h_payto
,in_expiration_date)
- ON CONFLICT DO NOTHING;
+ ON CONFLICT DO NOTHING
+ RETURNING reserve_pub)
+ SELECT * FROM reserve_transaction;
+ FETCH FROM curs_trans INTO i;
IF FOUND
THEN
+ IF i.reserve_pub = in_reserve_pub
+ THEN
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
- transaction_duplicate = FALSE;
- ELSE
- -- Unhappy...
- RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave
conflict';
- transaction_duplicate = TRUE;
--- ROLLBACK;
+ transaction_duplicate = FALSE;
+ END IF;
END IF;
+ CLOSE curs_trans;
RETURN;
END $$;
diff --git a/src/exchangedb/pg_batch2_reserves_in_insert.c
b/src/exchangedb/pg_batch2_reserves_in_insert.c
index e0208f09..1ef9045d 100644
--- a/src/exchangedb/pg_batch2_reserves_in_insert.c
+++ b/src/exchangedb/pg_batch2_reserves_in_insert.c
@@ -817,7 +817,7 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
}
need_update |= conflicts[i];
t_duplicate |= transaction_duplicate[i];
- // fprintf(stdout, "reserve uuid : %ld c :%d t:%d\n",
reserve_uuid[i], conflicts[i], transaction_duplicate[i]);
+ // fprintf(stdout, "reserve uuid : %ld c :%d t:%d\n", reserve_uuid[i],
conflicts[i], transaction_duplicate[i]);
i += 1;
break;
case 0:
diff --git a/src/exchangedb/test_exchangedb_by_j.c
b/src/exchangedb/test_exchangedb_by_j.c
index 533871cc..9769d964 100644
--- a/src/exchangedb/test_exchangedb_by_j.c
+++ b/src/exchangedb/test_exchangedb_by_j.c
@@ -107,7 +107,7 @@ run (void *cls)
const char *sndr = "payto://x-taler-bank/localhost:8080/1";
struct TALER_Amount value;
unsigned int batch_size = batches[i];
- unsigned int iterations = 10000;//1024*10;
+ unsigned int iterations = 16;//1024*10;
struct TALER_ReservePublicKeyP reserve_pubs[iterations];
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp ts;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: try batch1 with cursor,
gnunet <=