modifications applied to batch test...

This commit is contained in:
Joseph 2023-01-05 09:22:16 -05:00
parent d805c54052
commit 043c46c59d
No known key found for this signature in database
GPG Key ID: E709789D3076B5CC
4 changed files with 138 additions and 50 deletions

View File

@ -52,6 +52,8 @@ DECLARE
i RECORD; i RECORD;
DECLARE DECLARE
r RECORD; r RECORD;
DECLARE
k INT8;
BEGIN BEGIN
--SIMPLE INSERT ON CONFLICT DO NOTHING --SIMPLE INSERT ON CONFLICT DO NOTHING
transaction_duplicate=TRUE; transaction_duplicate=TRUE;
@ -60,6 +62,7 @@ BEGIN
out_reserve_found2 = TRUE; out_reserve_found2 = TRUE;
ruuid=0; ruuid=0;
ruuid2=0; ruuid2=0;
k=0;
INSERT INTO wire_targets INSERT INTO wire_targets
(wire_target_h_payto (wire_target_h_payto
,payto_uri) ,payto_uri)
@ -92,27 +95,17 @@ BEGIN
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
RETURNING reserve_uuid,reserve_pub) RETURNING reserve_uuid,reserve_pub)
SELECT * FROM reserve_changes; SELECT * FROM reserve_changes;
WHILE k < 2 LOOP
FETCH FROM curs_reserve_exist INTO i; FETCH FROM curs_reserve_exist INTO i;
IF FOUND IF FOUND
THEN THEN
IF in_reserve_pub = i.reserve_pub IF in_reserve_pub = i.reserve_pub
THEN THEN
out_reserve_found = FALSE;
ruuid = i.reserve_uuid; ruuid = i.reserve_uuid;
END IF; IF in_reserve_pub <> in2_reserve_pub
IF in2_reserve_pub = i.reserve_pub
THEN
out_reserve_found2 = FALSE;
ruuid2 = i.reserve_uuid;
END IF;
FETCH FROM curs_reserve_exist INTO i;
IF FOUND
THEN
IF in_reserve_pub = i.reserve_pub
THEN THEN
out_reserve_found = FALSE; out_reserve_found = FALSE;
ruuid = i.reserve_uuid; END IF;
END IF; END IF;
IF in2_reserve_pub = i.reserve_pub IF in2_reserve_pub = i.reserve_pub
THEN THEN
@ -120,7 +113,8 @@ BEGIN
ruuid2 = i.reserve_uuid; ruuid2 = i.reserve_uuid;
END IF; END IF;
END IF; END IF;
END IF; k=k+1;
END LOOP;
CLOSE curs_reserve_exist; CLOSE curs_reserve_exist;
PERFORM pg_notify(in_notify, NULL); PERFORM pg_notify(in_notify, NULL);

View File

@ -148,23 +148,47 @@ BEGIN
THEN THEN
IF in_reserve_pub = i.reserve_pub IF in_reserve_pub = i.reserve_pub
THEN THEN
out_reserve_found = FALSE;
ruuid = i.reserve_uuid; 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; END IF;
IF in2_reserve_pub = i.reserve_pub IF in2_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in3_reserve_pub = i.reserve_pub IF in3_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in4_reserve_pub = i.reserve_pub IF in4_reserve_pub = i.reserve_pub
THEN 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;
END IF; END IF;
k=k+1; k=k+1;

View File

@ -245,43 +245,123 @@ BEGIN
THEN THEN
IF in_reserve_pub = i.reserve_pub IF in_reserve_pub = i.reserve_pub
THEN THEN
out_reserve_found = FALSE;
ruuid = i.reserve_uuid; 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; END IF;
IF in2_reserve_pub = i.reserve_pub IF in2_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in3_reserve_pub = i.reserve_pub IF in3_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in4_reserve_pub = i.reserve_pub IF in4_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in5_reserve_pub = i.reserve_pub IF in5_reserve_pub = i.reserve_pub
THEN THEN
out_reserve_found5 = FALSE;
ruuid5 = i.reserve_uuid; 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; END IF;
IF in6_reserve_pub = i.reserve_pub IF in6_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in7_reserve_pub = i.reserve_pub IF in7_reserve_pub = i.reserve_pub
THEN 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; END IF;
IF in8_reserve_pub = i.reserve_pub IF in8_reserve_pub = i.reserve_pub
THEN 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;
END IF; END IF;
k=k+1; k=k+1;
@ -369,7 +449,6 @@ BEGIN
RETURNING reserve_pub) RETURNING reserve_pub)
SELECT * FROM reserve_in_changes; SELECT * FROM reserve_in_changes;
WHILE k < 8 LOOP WHILE k < 8 LOOP
FETCH FROM curs_transaction_existed INTO r; FETCH FROM curs_transaction_existed INTO r;
IF FOUND IF FOUND

View File

@ -709,8 +709,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
qs1); qs1);
return 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];
need_update |= conflicts[i+1]; need_update |= conflicts[i+1];
need_update |= conflicts[i+2]; 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+1];
t_duplicate |= transaction_duplicate[i+2]; t_duplicate |= transaction_duplicate[i+2];
t_duplicate |= transaction_duplicate[i+3]; 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; i += 4;
break; break;
case 3: case 3:
@ -791,7 +787,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
need_update |= conflicts[i+1]; need_update |= conflicts[i+1];
t_duplicate |= transaction_duplicate[i]; t_duplicate |= transaction_duplicate[i];
t_duplicate |= transaction_duplicate[i+1]; t_duplicate |= transaction_duplicate[i+1];
// fprintf(stdout, "t : %d %d", transaction_duplicate[i], transaction_duplicate[i+1]);
i += 2; i += 2;
break; break;
case 1: case 1:
@ -811,13 +806,9 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
GNUNET_break (0); GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
// fprintf(stdout, "%ld\n", reserve_uuid[i]);
need_update |= conflicts[i]; need_update |= conflicts[i];
t_duplicate |= transaction_duplicate[i]; t_duplicate |= transaction_duplicate[i];
// fprintf(stdout, "%ld c:%d t:%d\n", reserve_uuid[i], conflicts[i], transaction_duplicate[i]);
i += 1; i += 1;
break; break;
case 0: case 0:
GNUNET_assert (0); GNUNET_assert (0);