aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph <Joseph.xu@efrei.net>2023-01-04 09:43:47 -0500
committerJoseph <Joseph.xu@efrei.net>2023-01-04 09:43:47 -0500
commit069708205c0b14e311f8916788275b121cae2c0e (patch)
tree9abfc8810da5778c54404e68a5251a1f45d67907
parent2eb59d9135734b614509adc16fdb0f061d05634a (diff)
downloadexchange-069708205c0b14e311f8916788275b121cae2c0e.tar.xz
some modifications for batch_test
-rw-r--r--src/exchangedb/exchange_do_batch2_reserves_in_insert.sql4
-rw-r--r--src/exchangedb/exchange_do_batch4_reserves_in_insert.sql7
-rw-r--r--src/exchangedb/exchange_do_batch8_reserves_in_insert.sql4
-rw-r--r--src/exchangedb/exchange_do_batch_reserves_in_insert.sql4
-rw-r--r--src/exchangedb/pg_batch2_reserves_in_insert.c16
-rw-r--r--src/exchangedb/test_exchangedb_populate_table.c1
6 files changed, 21 insertions, 15 deletions
diff --git a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
index d341642f9..2100f7de6 100644
--- a/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch2_reserves_in_insert.sql
@@ -182,13 +182,13 @@ BEGIN
END IF;
END IF;
END IF;
-/* IF transaction_duplicate
+ IF transaction_duplicate
OR transaction_duplicate2
THEN
CLOSE curs_transaction_exist;
ROLLBACK;
RETURN;
- END IF;*/
+ END IF;
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 e2ab133bd..15d8ef6ff 100644
--- a/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch4_reserves_in_insert.sql
@@ -249,16 +249,17 @@ BEGIN
END IF;
k=k+1;
END LOOP;
-/* IF transaction_duplicate
+
+ IF transaction_duplicate
OR transaction_duplicate2
OR transaction_duplicate3
OR transaction_duplicate4
THEN
RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict';
-
+ ROLLBACK;
CLOSE curs_transaction_exist;
RETURN;
- END IF;*/
+ END IF;
CLOSE curs_transaction_exist;
RETURN;
diff --git a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
index 2c61bfedf..6076f3299 100644
--- a/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch8_reserves_in_insert.sql
@@ -421,7 +421,7 @@ BEGIN
END IF;
k=k+1;
END LOOP;
-/* IF transaction_duplicate
+ IF transaction_duplicate
OR transaction_duplicate2
OR transaction_duplicate3
OR transaction_duplicate4
@@ -433,7 +433,7 @@ BEGIN
CLOSE curs_transaction_existed;
ROLLBACK;
RETURN;
- END IF;*/
+ END IF;
CLOSE curs_transaction_existed;
RETURN;
END $$;
diff --git a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
index 7c11bee83..4ae7f68a2 100644
--- a/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
+++ b/src/exchangedb/exchange_do_batch_reserves_in_insert.sql
@@ -94,9 +94,9 @@ transaction_duplicate= TRUE;
RETURN;
ELSE
-- 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;
--- ROLLBACK;
+ ROLLBACK;
RETURN;
END IF;
RETURN;
diff --git a/src/exchangedb/pg_batch2_reserves_in_insert.c b/src/exchangedb/pg_batch2_reserves_in_insert.c
index 90848e0e6..34c15d1da 100644
--- a/src/exchangedb/pg_batch2_reserves_in_insert.c
+++ b/src/exchangedb/pg_batch2_reserves_in_insert.c
@@ -764,6 +764,8 @@ 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 +793,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
t_duplicate |= transaction_duplicate[i];
t_duplicate |= transaction_duplicate[i+1];
- //fprintf(stdout, "%ld %ld c:%d t:%d\n", reserve_uuid[i], reserve_uuid[i+1], conflicts[i], transaction_duplicate[i]);
i += 2;
break;
case 1:
@@ -835,13 +836,19 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
return cs;
}
}
-
if (! need_update)
{
goto exit;
}
+ /* fprintf(stdout, "t : %d", t_duplicate);
if (t_duplicate)
- goto exit;
+ {
+ GNUNET_break (0);
+ TEH_PG_rollback (pg);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
+ */
+
// begin serializable
{
if (GNUNET_OK !=
@@ -864,7 +871,6 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
{
if (! conflicts[i])
continue;
- // fprintf(stdout, "%d\n", conflicts[i]);
{
bool duplicate;
struct GNUNET_PQ_QueryParam params[] = {
@@ -889,7 +895,7 @@ TEH_PG_batch2_reserves_in_insert (void *cls,
if (qs3<0)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failed to update (%d)\n",
+ "Failed to update reserves (%d)\n",
qs3);
results[i] = qs3;
return qs3;
diff --git a/src/exchangedb/test_exchangedb_populate_table.c b/src/exchangedb/test_exchangedb_populate_table.c
index ae1d5bdfa..d67d1307a 100644
--- a/src/exchangedb/test_exchangedb_populate_table.c
+++ b/src/exchangedb/test_exchangedb_populate_table.c
@@ -538,7 +538,6 @@ run (void *cls)
plugin->insert_refund (plugin->cls,
&ref));
}*/
-
}
result = 0;