-ensure single transaction for exchange-0001.sql / shard-0001.sql
This commit is contained in:
parent
5f1d8fc406
commit
dc26b2db4c
@ -16,8 +16,10 @@ sqldir = $(prefix)/share/taler/sql/exchange/
|
||||
|
||||
sqlinputs = \
|
||||
common-0001.sql \
|
||||
exchange-0001.sql.in \
|
||||
exchange-0001-part.sql \
|
||||
shard-0001-part.sql
|
||||
shard-0001-part.sql \
|
||||
shard-0001.sql.in
|
||||
|
||||
sql_DATA = \
|
||||
benchmark-0001.sql \
|
||||
@ -37,14 +39,14 @@ CLEANFILES = \
|
||||
shard-0001.sql \
|
||||
exchange-0001.sql
|
||||
|
||||
exchange-0001.sql: common-0001.sql exchange-0001-part.sql
|
||||
exchange-0001.sql: common-0001.sql exchange-0001-part.sql exchange-0001.sql.in
|
||||
chmod +w $@ || true
|
||||
cat common-0001.sql exchange-0001-part.sql >$@
|
||||
gcc -E -P -undef - < exchange-0001.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@
|
||||
chmod ugo-w $@
|
||||
|
||||
shard-0001.sql: common-0001.sql shard-0001-part.sql
|
||||
shard-0001.sql: common-0001.sql shard-0001-part.sql exchange-0001.sql.in
|
||||
chmod +w $@ || true
|
||||
cat common-0001.sql shard-0001-part.sql >$@
|
||||
gcc -E -P -undef - < shard-0001.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@
|
||||
chmod ugo-w $@
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
@ -14,16 +14,6 @@
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
-- Everything in one big transaction
|
||||
BEGIN;
|
||||
|
||||
-------------------- Schema ----------------------------
|
||||
|
||||
CREATE SCHEMA exchange;
|
||||
COMMENT ON SCHEMA exchange IS 'taler-exchange data';
|
||||
|
||||
SET search_path TO exchange;
|
||||
|
||||
-------------------- Tables ----------------------------
|
||||
|
||||
CREATE OR REPLACE FUNCTION create_partitioned_table(
|
||||
@ -2750,5 +2740,3 @@ BEGIN
|
||||
|
||||
END
|
||||
$$;
|
||||
|
||||
COMMIT;
|
||||
|
@ -14,12 +14,6 @@
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
-- Everything in one big transaction
|
||||
BEGIN;
|
||||
|
||||
-- Check patch versioning is in place.
|
||||
SELECT _v.register_patch('exchange-0001', NULL, NULL);
|
||||
|
||||
-- ------------------------------ denominations ----------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS denominations
|
||||
@ -1404,12 +1398,3 @@ CREATE TRIGGER purse_requests_on_update
|
||||
COMMENT ON TRIGGER purse_requests_on_update
|
||||
ON purse_requests
|
||||
IS 'This covers the case where a deposit is made into a purse, which inherently then changes the purse balance via an UPDATE. If the merge is already present and the balance matches the total, we trigger the router. Once the router sets the purse to finished, the trigger will remove the purse from the watchlist of the router.';
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- THE END
|
||||
-------------------------------------------------------------
|
||||
|
||||
-- Complete transaction
|
||||
COMMIT;
|
||||
|
33
src/exchangedb/exchange-0001.sql.in
Normal file
33
src/exchangedb/exchange-0001.sql.in
Normal file
@ -0,0 +1,33 @@
|
||||
--
|
||||
-- This file is part of TALER
|
||||
-- Copyright (C) 2014--2022 Taler Systems SA
|
||||
--
|
||||
-- TALER is free software; you can redistribute it and/or modify it under the
|
||||
-- terms of the GNU General Public License as published by the Free Software
|
||||
-- Foundation; either version 3, or (at your option) any later version.
|
||||
--
|
||||
-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License along with
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
-- Everything in one big transaction
|
||||
BEGIN;
|
||||
|
||||
-- Check patch versioning is in place.
|
||||
SELECT _v.register_patch('exchange-0001', NULL, NULL);
|
||||
|
||||
-------------------- Schema ----------------------------
|
||||
|
||||
CREATE SCHEMA exchange;
|
||||
COMMENT ON SCHEMA exchange IS 'taler-exchange data';
|
||||
|
||||
SET search_path TO exchange;
|
||||
|
||||
#include "common-0001.sql"
|
||||
#include "exchange-0001-part.sql"
|
||||
|
||||
COMMIT;
|
@ -14,12 +14,6 @@
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
-- Everything in one big transaction
|
||||
BEGIN;
|
||||
|
||||
-- Check patch versioning is in place.
|
||||
SELECT _v.register_patch('shard-0001', NULL, NULL);
|
||||
|
||||
CREATE OR REPLACE FUNCTION setup_shard(
|
||||
shard_idx INTEGER
|
||||
)
|
||||
@ -121,153 +115,3 @@ BEGIN
|
||||
PERFORM add_constraints_to_wad_in_entries_partition(shard_suffix);
|
||||
END
|
||||
$$;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION drop_shard(
|
||||
shard_idx INTEGER
|
||||
)
|
||||
RETURNS VOID
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
shard_suffix VARCHAR;
|
||||
BEGIN
|
||||
|
||||
shard_suffix = shard_idx::varchar;
|
||||
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'wire_targets_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'reserves_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'reserves_in_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'reserves_out_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'reserves_close_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'known_coins_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'refresh_commitments_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'refresh_revealed_coins_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'refresh_transfer_keys_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'deposits_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'deposits_by_ready_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'deposits_for_matching_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'refunds_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'wire_out_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'aggregation_transient_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'aggregation_tracking_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'recoup_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'recoup_by_reserve_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'reserves_out_by_reserve_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'recoup_refresh_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'prewire_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'cs_nonce_locks_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'purse_requests_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'purse_refunds_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'purse_merges_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'account_merges_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'contracts_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'history_requests_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'close_requests_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'purse_deposits_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'wad_out_entries_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'wads_in_' || shard_suffix
|
||||
);
|
||||
EXECUTE FORMAT(
|
||||
'DROP TABLE IF EXISTS %I CASCADE'
|
||||
,'wad_in_entries_' || shard_suffix
|
||||
);
|
||||
END
|
||||
$$;
|
||||
|
||||
COMMIT;
|
||||
|
33
src/exchangedb/shard-0001.sql.in
Normal file
33
src/exchangedb/shard-0001.sql.in
Normal file
@ -0,0 +1,33 @@
|
||||
--
|
||||
-- This file is part of TALER
|
||||
-- Copyright (C) 2014--2022 Taler Systems SA
|
||||
--
|
||||
-- TALER is free software; you can redistribute it and/or modify it under the
|
||||
-- terms of the GNU General Public License as published by the Free Software
|
||||
-- Foundation; either version 3, or (at your option) any later version.
|
||||
--
|
||||
-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License along with
|
||||
-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
--
|
||||
|
||||
-- Everything in one big transaction
|
||||
BEGIN;
|
||||
|
||||
-- Check patch versioning is in place.
|
||||
SELECT _v.register_patch('shard-0001', NULL, NULL);
|
||||
|
||||
-------------------- Schema ----------------------------
|
||||
|
||||
CREATE SCHEMA exchange;
|
||||
COMMENT ON SCHEMA exchange IS 'taler-exchange data';
|
||||
|
||||
SET search_path TO exchange;
|
||||
|
||||
#include "common-0001.sql"
|
||||
#include "shard-0001-part.sql"
|
||||
|
||||
COMMIT;
|
Loading…
Reference in New Issue
Block a user