aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorJoseph <Joseph.xu@efrei.net>2023-01-05 09:22:16 -0500
committerJoseph <Joseph.xu@efrei.net>2023-01-05 09:22:16 -0500
commit043c46c59d62abcafef5c37fb97c66995e6b3859 (patch)
treef121671c6db0f942c7dbf6e5da273e04282bf1b4 /src/exchangedb
parentd805c54052a4684a7312e05186169fb66c35668b (diff)
modifications applied to batch test...
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/exchange_do_batch2_reserves_in_insert.sql32
-rw-r--r--src/exchangedb/exchange_do_batch4_reserves_in_insert.sql38
-rw-r--r--src/exchangedb/exchange_do_batch8_reserves_in_insert.sql109
-rw-r--r--src/exchangedb/pg_batch2_reserves_in_insert.c9
4 files changed, 138 insertions, 50 deletions
diff --git a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
index d1cc10415..bda644eca 100644
--- a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
@@ -52,6 +52,8 @@ DECLARE
i RECORD;
DECLARE
r RECORD;
+DECLARE
+ k INT8;
BEGIN
--SIMPLE INSERT ON CONFLICT DO NOTHING
transaction_duplicate=TRUE;
@@ -60,6 +62,7 @@ BEGIN
out_reserve_found2 = TRUE;
ruuid=0;
ruuid2=0;
+ k=0;
INSERT INTO wire_targets
(wire_target_h_payto
,payto_uri)
@@ -92,35 +95,26 @@ BEGIN
ON CONFLICT DO NOTHING
RETURNING reserve_uuid,reserve_pub)
SELECT * FROM reserve_changes;
-
- FETCH FROM curs_reserve_exist INTO i;
- IF FOUND
- THEN
- IF in_reserve_pub = i.reserve_pub
- THEN
- out_reserve_found = FALSE;
- ruuid = i.reserve_uuid;
- END IF;
- IF in2_reserve_pub = i.reserve_pub
- THEN
- out_reserve_found2 = FALSE;
- ruuid2 = i.reserve_uuid;
- END IF;
+ WHILE k < 2 LOOP
FETCH FROM curs_reserve_exist INTO i;
IF FOUND
THEN
IF in_reserve_pub = i.reserve_pub
THEN
- out_reserve_found = FALSE;
ruuid = i.reserve_uuid;
+ IF in_reserve_pub <> in2_reserve_pub
+ THEN
+ out_reserve_found = FALSE;
+ END IF;
END IF;
IF in2_reserve_pub = i.reserve_pub
THEN
- out_reserve_found2 = FALSE;
- ruuid2 = i.reserve_uuid;
- END IF;
+ out_reserve_found2 = FALSE;
+ ruuid2 = i.reserve_uuid;
+ END IF;
END IF;
- END IF;
+ k=k+1;
+ END LOOP;
CLOSE curs_reserve_exist;
PERFORM pg_notify(in_notify, NULL);
diff --git a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
index 1817e695a..c2157f7d3 100644
--- a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
@@ -148,23 +148,47 @@ BEGIN
THEN
IF in_reserve_pub = i.reserve_pub
THEN
- out_reserve_found = FALSE;
ruuid = i.reserve_uuid;
+ IF in_reserve_pub
+ NOT IN (in2_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub)
+ THEN
+ out_reserve_found = FALSE;
+ END IF;
END IF;
IF in2_reserve_pub = i.reserve_pub
THEN
- out_reserve_found2 = FALSE;
- ruuid2 = i.reserve_uuid;
+ ruuid2 = i.reserve_uuid;
+ IF in2_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub)
+ THEN
+ out_reserve_found2 = FALSE;
+ END IF;
END IF;
IF in3_reserve_pub = i.reserve_pub
THEN
- out_reserve_found3 = FALSE;
- ruuid3 = i.reserve_uuid;
+ ruuid3 = i.reserve_uuid;
+ IF in3_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in4_reserve_pub)
+ THEN
+ out_reserve_found3 = FALSE;
+ END IF;
END IF;
IF in4_reserve_pub = i.reserve_pub
THEN
- out_reserve_found4 = FALSE;
- ruuid4 = i.reserve_uuid;
+ ruuid4 = i.reserve_uuid;
+ IF in4_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in3_reserve_pub)
+ THEN
+ out_reserve_found4 = FALSE;
+ END IF;
END IF;
END IF;
k=k+1;
diff --git a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
index 997a7b3e2..68b9c8fa5 100644
--- a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
@@ -245,43 +245,123 @@ BEGIN
THEN
IF in_reserve_pub = i.reserve_pub
THEN
- out_reserve_found = FALSE;
ruuid = i.reserve_uuid;
+ IF in_reserve_pub
+ NOT IN (in2_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub
+ ,in5_reserve_pub
+ ,in6_reserve_pub
+ ,in7_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found = FALSE;
+ END IF;
END IF;
IF in2_reserve_pub = i.reserve_pub
THEN
- out_reserve_found2 = FALSE;
- ruuid2 = i.reserve_uuid;
+ ruuid2 = i.reserve_uuid;
+ IF in2_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub
+ ,in5_reserve_pub
+ ,in6_reserve_pub
+ ,in7_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found2 = FALSE;
+ END IF;
END IF;
IF in3_reserve_pub = i.reserve_pub
THEN
- out_reserve_found3 = FALSE;
- ruuid3 = i.reserve_uuid;
+ ruuid3 = i.reserve_uuid;
+ IF in3_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in4_reserve_pub
+ ,in5_reserve_pub
+ ,in6_reserve_pub
+ ,in7_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found3 = FALSE;
+ END IF;
END IF;
IF in4_reserve_pub = i.reserve_pub
THEN
- out_reserve_found4 = FALSE;
- ruuid4 = i.reserve_uuid;
+ ruuid4 = i.reserve_uuid;
+ IF in4_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in3_reserve_pub
+ ,in5_reserve_pub
+ ,in6_reserve_pub
+ ,in7_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found4 = FALSE;
+ END IF;
END IF;
IF in5_reserve_pub = i.reserve_pub
THEN
- out_reserve_found5 = FALSE;
ruuid5 = i.reserve_uuid;
+ IF in5_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub
+ ,in6_reserve_pub
+ ,in7_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found5 = FALSE;
+ END IF;
END IF;
IF in6_reserve_pub = i.reserve_pub
THEN
- out_reserve_found6 = FALSE;
- ruuid6 = i.reserve_uuid;
+ ruuid6 = i.reserve_uuid;
+ IF in6_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub
+ ,in5_reserve_pub
+ ,in7_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found6 = FALSE;
+ END IF;
END IF;
IF in7_reserve_pub = i.reserve_pub
THEN
- out_reserve_found7 = FALSE;
- ruuid7 = i.reserve_uuid;
+ ruuid7 = i.reserve_uuid;
+ IF in7_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub
+ ,in5_reserve_pub
+ ,in6_reserve_pub
+ ,in8_reserve_pub)
+ THEN
+ out_reserve_found7 = FALSE;
+ END IF;
END IF;
IF in8_reserve_pub = i.reserve_pub
THEN
- out_reserve_found8 = FALSE;
- ruuid8 = i.reserve_uuid;
+ ruuid8 = i.reserve_uuid;
+ IF in8_reserve_pub
+ NOT IN (in_reserve_pub
+ ,in2_reserve_pub
+ ,in3_reserve_pub
+ ,in4_reserve_pub
+ ,in5_reserve_pub
+ ,in6_reserve_pub
+ ,in7_reserve_pub)
+ THEN
+ out_reserve_found8 = FALSE;
+ END IF;
END IF;
END IF;
k=k+1;
@@ -369,7 +449,6 @@ BEGIN
RETURNING reserve_pub)
SELECT * FROM reserve_in_changes;
-
WHILE k < 8 LOOP
FETCH FROM curs_transaction_existed INTO r;
IF FOUND
diff --git a/src/exchangedb/pg_batch2_reserves_in_insert.c b/src/exchangedb/pg_batch2_reserves_in_insert.c
index a1fc7d5a4..dd4c10f75 100644
--- a/src/exchangedb/pg_batch2_reserves_in_insert.c
+++ b/src/exchangedb/pg_batch2_reserves_in_insert.c
@@ -709,8 +709,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
qs1);
return qs1;
}
- // fprintf(stdout, "%ld %ld %ld %ld %ld %ld %ld %ld\n", reserve_uuid[i], reserve_uuid[i+1], reserve_uuid[i+2], reserve_uuid[i+3], reserve_uuid[i+4], reserve_uuid[i+5], reserve_uuid[i+6],reserve_uuid[]);
- // fprintf(stdout, "%d %d %d %d %d %d %d %d\n", conflicts[i], conflicts[i+1], conflicts[i+2], conflicts[i+3], conflicts[i+4], conflicts[i+5], conflicts[i+6],conflicts[]);
need_update |= conflicts[i];
need_update |= conflicts[i+1];
need_update |= conflicts[i+2];
@@ -763,8 +761,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
t_duplicate |= transaction_duplicate[i+1];
t_duplicate |= transaction_duplicate[i+2];
t_duplicate |= transaction_duplicate[i+3];
- // fprintf(stdout, "%ld %ld c:%d t:%d %d %d %d\n", reserve_uuid[i], reserve_uuid[i+1], conflicts[i], t_duplicate, t_duplicate, transaction_duplicate[i+2], transaction_duplicate[i+3]);
-
i += 4;
break;
case 3:
@@ -791,7 +787,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
need_update |= conflicts[i+1];
t_duplicate |= transaction_duplicate[i];
t_duplicate |= transaction_duplicate[i+1];
- // fprintf(stdout, "t : %d %d", transaction_duplicate[i], transaction_duplicate[i+1]);
i += 2;
break;
case 1:
@@ -811,13 +806,9 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
- // fprintf(stdout, "%ld\n", reserve_uuid[i]);
need_update |= conflicts[i];
t_duplicate |= transaction_duplicate[i];
-
- // fprintf(stdout, "%ld c:%d t:%d\n", reserve_uuid[i], conflicts[i], transaction_duplicate[i]);
i += 1;
-
break;
case 0:
GNUNET_assert (0);