[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated (04942749 -> 5fd03d1d)
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated (04942749 -> 5fd03d1d) |
Date: |
Tue, 17 Oct 2023 14:01:26 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a change to branch master
in repository exchange.
from 04942749 use reserve history instead of materialized index
new 683b7247 -more fixmes
new 5fd03d1d implement recoup_refresh GC logic
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/exchangedb/0002-recoup_refresh.sql | 10 ++++--
src/exchangedb/exchange_do_gc.sql | 40 ++++++++++++----------
src/exchangedb/exchange_do_melt.sql | 6 ++--
src/exchangedb/exchange_do_recoup_to_coin.sql | 4 +--
.../pg_select_recoup_refresh_above_serial_id.c | 2 --
5 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/src/exchangedb/0002-recoup_refresh.sql
b/src/exchangedb/0002-recoup_refresh.sql
index 45c78557..8b979a49 100644
--- a/src/exchangedb/0002-recoup_refresh.sql
+++ b/src/exchangedb/0002-recoup_refresh.sql
@@ -51,7 +51,7 @@ BEGIN
,partition_suffix
);
PERFORM comment_partitioned_column(
- 'FIXME: (To be) used for garbage collection (in the absence of foreign
constraints, in the future)'
+ 'Used for garbage collection (in the absence of foreign constraints, in
the future)'
,'known_coin_id'
,table_name
,partition_suffix
@@ -82,13 +82,17 @@ DECLARE
table_name TEXT DEFAULT 'recoup_refresh';
BEGIN
table_name = concat_ws('_', table_name, partition_suffix);
- -- FIXME: any query using this index will be slow. Materialize index or
change query?
- -- Also: which query uses this index?
+
EXECUTE FORMAT (
'CREATE INDEX ' || table_name || '_by_rrc_serial_index'
' ON ' || table_name || ' '
'(rrc_serial);'
);
+ EXECUTE FORMAT (
+ 'COMMENT ON INDEX ' || table_name || '_by_rrc_serial_index '
+ 'IS ' || quote_literal('used in exchange_do_melt for zombie coins (rare)')
|| ';'
+ );
+
EXECUTE FORMAT (
'CREATE INDEX ' || table_name || '_by_coin_pub_index'
' ON ' || table_name || ' '
diff --git a/src/exchangedb/exchange_do_gc.sql
b/src/exchangedb/exchange_do_gc.sql
index 140a4553..d4ecb302 100644
--- a/src/exchangedb/exchange_do_gc.sql
+++ b/src/exchangedb/exchange_do_gc.sql
@@ -28,10 +28,10 @@ DECLARE
denom_min INT8; -- minimum denomination still alive
BEGIN
-DELETE FROM exchange.prewire
+DELETE FROM prewire
WHERE finished=TRUE;
-DELETE FROM exchange.wire_fee
+DELETE FROM wire_fee
WHERE end_date < in_ancient_date;
-- FIXME: use closing fee as threshold?
@@ -47,15 +47,14 @@ SELECT
ORDER BY reserve_out_serial_id ASC
LIMIT 1;
-DELETE FROM exchange.recoup
+DELETE FROM recoup
WHERE reserve_out_serial_id < reserve_out_min;
--- FIXME: recoup_refresh lacks GC!
SELECT
reserve_uuid
INTO
reserve_uuid_min
- FROM exchange.reserves
+ FROM reserves
ORDER BY reserve_uuid ASC
LIMIT 1;
@@ -74,52 +73,55 @@ DELETE FROM denominations
FROM known_coins
WHERE coin_pub IN
(SELECT DISTINCT coin_pub
- FROM exchange.recoup))
+ FROM recoup))
AND denominations_serial NOT IN
(SELECT DISTINCT denominations_serial
- FROM exchange.known_coins
+ FROM known_coins
WHERE coin_pub IN
(SELECT DISTINCT coin_pub
- FROM exchange.recoup_refresh));
+ FROM recoup_refresh));
SELECT
melt_serial_id
INTO
melt_min
- FROM exchange.refresh_commitments
+ FROM refresh_commitments
ORDER BY melt_serial_id ASC
LIMIT 1;
-DELETE FROM exchange.refresh_revealed_coins
+DELETE FROM refresh_revealed_coins
WHERE melt_serial_id < melt_min;
-DELETE FROM exchange.refresh_transfer_keys
+DELETE FROM refresh_transfer_keys
WHERE melt_serial_id < melt_min;
SELECT
known_coin_id
INTO
coin_min
- FROM exchange.known_coins
+ FROM known_coins
ORDER BY known_coin_id ASC
LIMIT 1;
-DELETE FROM exchange.batch_deposits
+DELETE FROM recoup_refresh
+ WHERE known_coin_id < coin_min;
+
+DELETE FROM batch_deposits
WHERE wire_deadline < in_ancient_date;
SELECT
batch_deposit_serial_id
INTO
batch_deposit_min
- FROM exchange.coin_deposits
+ FROM coin_deposits
ORDER BY batch_deposit_serial_id ASC
LIMIT 1;
-DELETE FROM exchange.refunds
+DELETE FROM refunds
WHERE batch_deposit_serial_id < batch_deposit_min;
-DELETE FROM exchange.aggregation_tracking
+DELETE FROM aggregation_tracking
WHERE batch_deposit_serial_id < batch_deposit_min;
-DELETE FROM exchange.coin_deposits
+DELETE FROM coin_deposits
WHERE batch_deposit_serial_id < batch_deposit_min;
@@ -128,11 +130,11 @@ SELECT
denominations_serial
INTO
denom_min
- FROM exchange.denominations
+ FROM denominations
ORDER BY denominations_serial ASC
LIMIT 1;
-DELETE FROM exchange.cs_nonce_locks
+DELETE FROM cs_nonce_locks
WHERE max_denomination_serial <= denom_min;
END $$;
diff --git a/src/exchangedb/exchange_do_melt.sql
b/src/exchangedb/exchange_do_melt.sql
index 7451577d..0200986f 100644
--- a/src/exchangedb/exchange_do_melt.sql
+++ b/src/exchangedb/exchange_do_melt.sql
@@ -81,13 +81,13 @@ THEN
-- operations, and then see if any of these
-- reveal operations was involved in a recoup.
PERFORM
- FROM exchange.recoup_refresh
+ FROM recoup_refresh
WHERE rrc_serial IN
(SELECT rrc_serial
- FROM exchange.refresh_revealed_coins
+ FROM refresh_revealed_coins
WHERE melt_serial_id IN
(SELECT melt_serial_id
- FROM exchange.refresh_commitments
+ FROM refresh_commitments
WHERE old_coin_pub=in_old_coin_pub));
IF NOT FOUND
THEN
diff --git a/src/exchangedb/exchange_do_recoup_to_coin.sql
b/src/exchangedb/exchange_do_recoup_to_coin.sql
index 150b62db..6cecfb7f 100644
--- a/src/exchangedb/exchange_do_recoup_to_coin.sql
+++ b/src/exchangedb/exchange_do_recoup_to_coin.sql
@@ -67,7 +67,7 @@ THEN
recoup_timestamp
INTO
out_recoup_timestamp
- FROM exchange.recoup_refresh
+ FROM recoup_refresh
WHERE coin_pub=in_coin_pub;
out_recoup_ok=FOUND;
RETURN;
@@ -106,7 +106,7 @@ THEN
END IF;
-INSERT INTO exchange.recoup_refresh
+INSERT INTO recoup_refresh
(coin_pub
,known_coin_id
,coin_sig
diff --git a/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c
b/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c
index b6029777..22e09b46 100644
--- a/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c
+++ b/src/exchangedb/pg_select_recoup_refresh_above_serial_id.c
@@ -161,8 +161,6 @@ TEH_PG_select_recoup_refresh_above_serial_id (
};
enum GNUNET_DB_QueryStatus qs;
- /* Used in #postgres_select_recoup_refresh_above_serial_id() to obtain
- recoup-refresh transactions */
PREPARE (pg,
"recoup_refresh_get_incr",
"SELECT"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] branch master updated (04942749 -> 5fd03d1d),
gnunet <=