corrections applied to batch test
This commit is contained in:
parent
d1491fb421
commit
7933815ce6
@ -122,10 +122,6 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
CLOSE curs_reserve_exist;
|
CLOSE curs_reserve_exist;
|
||||||
IF out_reserve_found AND out_reserve_found2
|
|
||||||
THEN
|
|
||||||
RETURN;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
PERFORM pg_notify(in_notify, NULL);
|
PERFORM pg_notify(in_notify, NULL);
|
||||||
PERFORM pg_notify(in2_notify, NULL);
|
PERFORM pg_notify(in2_notify, NULL);
|
||||||
|
@ -170,13 +170,7 @@ BEGIN
|
|||||||
k=k+1;
|
k=k+1;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE curs_reserve_exist;
|
CLOSE curs_reserve_exist;
|
||||||
IF out_reserve_found
|
|
||||||
AND out_reserve_found2
|
|
||||||
AND out_reserve_found3
|
|
||||||
AND out_reserve_found4
|
|
||||||
THEN
|
|
||||||
RETURN;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
PERFORM pg_notify(in_notify, NULL);
|
PERFORM pg_notify(in_notify, NULL);
|
||||||
PERFORM pg_notify(in2_notify, NULL);
|
PERFORM pg_notify(in2_notify, NULL);
|
||||||
|
@ -289,17 +289,6 @@ BEGIN
|
|||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
CLOSE curs_reserve_existed;
|
CLOSE curs_reserve_existed;
|
||||||
IF out_reserve_found
|
|
||||||
AND out_reserve_found2
|
|
||||||
AND out_reserve_found3
|
|
||||||
AND out_reserve_found4
|
|
||||||
AND out_reserve_found5
|
|
||||||
AND out_reserve_found6
|
|
||||||
AND out_reserve_found7
|
|
||||||
AND out_reserve_found8
|
|
||||||
THEN
|
|
||||||
RETURN;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
PERFORM pg_notify(in_notify, NULL);
|
PERFORM pg_notify(in_notify, NULL);
|
||||||
PERFORM pg_notify(in2_notify, NULL);
|
PERFORM pg_notify(in2_notify, NULL);
|
||||||
|
@ -67,7 +67,6 @@ transaction_duplicate= TRUE;
|
|||||||
ELSE
|
ELSE
|
||||||
-- We made no change, which means the reserve existed.
|
-- We made no change, which means the reserve existed.
|
||||||
out_reserve_found = TRUE;
|
out_reserve_found = TRUE;
|
||||||
RETURN;
|
|
||||||
END IF;
|
END IF;
|
||||||
PERFORM pg_notify(in_notify, NULL);
|
PERFORM pg_notify(in_notify, NULL);
|
||||||
INSERT INTO reserves_in
|
INSERT INTO reserves_in
|
||||||
@ -91,13 +90,11 @@ transaction_duplicate= TRUE;
|
|||||||
THEN
|
THEN
|
||||||
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
|
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
|
||||||
transaction_duplicate = FALSE;
|
transaction_duplicate = FALSE;
|
||||||
RETURN;
|
|
||||||
ELSE
|
ELSE
|
||||||
-- Unhappy...
|
-- Unhappy...
|
||||||
RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict';
|
RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict';
|
||||||
transaction_duplicate = TRUE;
|
transaction_duplicate = TRUE;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
RETURN;
|
|
||||||
END IF;
|
END IF;
|
||||||
RETURN;
|
RETURN;
|
||||||
END $$;
|
END $$;
|
||||||
|
@ -69,7 +69,7 @@ insert1(struct PostgresClosure *pg,
|
|||||||
PREPARE (pg,
|
PREPARE (pg,
|
||||||
"batch1_reserve_create",
|
"batch1_reserve_create",
|
||||||
"SELECT "
|
"SELECT "
|
||||||
"out_reserve_found AS conflicted"
|
" out_reserve_found AS conflicted"
|
||||||
",transaction_duplicate"
|
",transaction_duplicate"
|
||||||
",ruuid AS reserve_uuid"
|
",ruuid AS reserve_uuid"
|
||||||
" FROM exchange_do_batch_reserves_in_insert"
|
" FROM exchange_do_batch_reserves_in_insert"
|
||||||
@ -103,7 +103,6 @@ insert1(struct PostgresClosure *pg,
|
|||||||
TALER_payto_hash (reserves[0].sender_account_details,
|
TALER_payto_hash (reserves[0].sender_account_details,
|
||||||
&h_payto);
|
&h_payto);
|
||||||
|
|
||||||
/* Note: query uses 'on conflict do nothing' */
|
|
||||||
qs2 = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
qs2 = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||||
"batch1_reserve_create",
|
"batch1_reserve_create",
|
||||||
params,
|
params,
|
||||||
@ -168,7 +167,7 @@ insert2 (struct PostgresClosure *pg,
|
|||||||
GNUNET_PQ_query_param_auto_from_type (&h_payto),
|
GNUNET_PQ_query_param_auto_from_type (&h_payto),
|
||||||
GNUNET_PQ_query_param_string (reserves[0].sender_account_details),
|
GNUNET_PQ_query_param_string (reserves[0].sender_account_details),
|
||||||
GNUNET_PQ_query_param_timestamp (&reserve_expiration),
|
GNUNET_PQ_query_param_timestamp (&reserve_expiration),
|
||||||
GNUNET_PQ_query_param_string (notify_s[0]), // FIXME: 2 different notifies!
|
GNUNET_PQ_query_param_string (notify_s[0]),
|
||||||
GNUNET_PQ_query_param_string (notify_s[1]),
|
GNUNET_PQ_query_param_string (notify_s[1]),
|
||||||
|
|
||||||
GNUNET_PQ_query_param_auto_from_type (reserves[1].reserve_pub),
|
GNUNET_PQ_query_param_auto_from_type (reserves[1].reserve_pub),
|
||||||
@ -210,7 +209,7 @@ insert2 (struct PostgresClosure *pg,
|
|||||||
if (qs1 < 0)
|
if (qs1 < 0)
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
"Failed to create reserves (%d)\n",
|
"Failed to create reserves 2(%d)\n",
|
||||||
qs1);
|
qs1);
|
||||||
results[0]=qs1;
|
results[0]=qs1;
|
||||||
return qs1;
|
return qs1;
|
||||||
@ -227,7 +226,7 @@ insert2 (struct PostgresClosure *pg,
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
TEH_PG_rollback (pg);
|
TEH_PG_rollback (pg); //ROLLBACK
|
||||||
results[0] = GNUNET_DB_STATUS_HARD_ERROR;
|
results[0] = GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
}
|
}
|
||||||
@ -691,7 +690,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
|
|||||||
reserves_length - i);
|
reserves_length - i);
|
||||||
if (bs >= 8)
|
if (bs >= 8)
|
||||||
{
|
{
|
||||||
// fprintf(stdout, "batch8");
|
|
||||||
qs1=insert8(pg,
|
qs1=insert8(pg,
|
||||||
&reserves[i],
|
&reserves[i],
|
||||||
expiry,
|
expiry,
|
||||||
@ -707,7 +705,7 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
|
|||||||
if (qs1<0)
|
if (qs1<0)
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
"Failed to update reserves8 (%d)\n",
|
"Failed to update reserves 8 (%d)\n",
|
||||||
qs1);
|
qs1);
|
||||||
return qs1;
|
return qs1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user