gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -ensure single transaction for e


From: gnunet
Subject: [taler-exchange] branch master updated: -ensure single transaction for exchange-0001.sql / shard-0001.sql
Date: Thu, 28 Jul 2022 22:27:25 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new dc26b2db -ensure single transaction for exchange-0001.sql / 
shard-0001.sql
dc26b2db is described below

commit dc26b2db4cecbca155f5df2678f60aadf13c3bd4
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jul 28 22:27:23 2022 +0200

    -ensure single transaction for exchange-0001.sql / shard-0001.sql
---
 src/exchangedb/Makefile.am            |  16 ++--
 src/exchangedb/common-0001.sql        |  12 ---
 src/exchangedb/exchange-0001-part.sql |  15 ----
 src/exchangedb/exchange-0001.sql.in   |  33 +++++++
 src/exchangedb/shard-0001-part.sql    | 156 ----------------------------------
 src/exchangedb/shard-0001.sql.in      |  33 +++++++
 6 files changed, 75 insertions(+), 190 deletions(-)

diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index af2bfc0c..01ce13de 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -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 \
@@ -25,7 +27,7 @@ sql_DATA = \
   exchange-0001.sql \
   drop.sql \
   procedures.sql \
-  shard-0001.sql 
+  shard-0001.sql
 
 BUILT_SOURCES = \
   shard-0001.sql \
@@ -35,16 +37,16 @@ BUILT_SOURCES = \
 
 CLEANFILES = \
   shard-0001.sql \
-  exchange-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 = \
diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql
index 6c4a6024..7ec6ce6a 100644
--- a/src/exchangedb/common-0001.sql
+++ b/src/exchangedb/common-0001.sql
@@ -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;
diff --git a/src/exchangedb/exchange-0001-part.sql 
b/src/exchangedb/exchange-0001-part.sql
index 15089778..60b45b44 100644
--- a/src/exchangedb/exchange-0001-part.sql
+++ b/src/exchangedb/exchange-0001-part.sql
@@ -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;
diff --git a/src/exchangedb/exchange-0001.sql.in 
b/src/exchangedb/exchange-0001.sql.in
new file mode 100644
index 00000000..a01ac3a8
--- /dev/null
+++ b/src/exchangedb/exchange-0001.sql.in
@@ -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;
diff --git a/src/exchangedb/shard-0001-part.sql 
b/src/exchangedb/shard-0001-part.sql
index e642fe65..629dac53 100644
--- a/src/exchangedb/shard-0001-part.sql
+++ b/src/exchangedb/shard-0001-part.sql
@@ -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;
diff --git a/src/exchangedb/shard-0001.sql.in b/src/exchangedb/shard-0001.sql.in
new file mode 100644
index 00000000..5a849a8a
--- /dev/null
+++ b/src/exchangedb/shard-0001.sql.in
@@ -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;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]