diff options
| author | Christian Grothoff <christian@grothoff.org> | 2022-02-28 20:37:19 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2022-02-28 20:37:19 +0100 | 
| commit | 23bc09fe3c2ca08ce209fffc0ad0ae3e51b06ef4 (patch) | |
| tree | 6a9dc253ce596c247a3aac6095205f195198b8d7 /src/exchangedb | |
| parent | 8f77bda2e0297185c98694edf0d752cc925bf9a2 (diff) | |
get test-auditor and #7181 to pass
Diffstat (limited to 'src/exchangedb')
| -rw-r--r-- | src/exchangedb/exchange-0001.sql | 186 | ||||
| -rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 5 | ||||
| -rw-r--r-- | src/exchangedb/test_exchangedb.c | 2 | 
3 files changed, 100 insertions, 93 deletions
| diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql index baf0056b..272ee84b 100644 --- a/src/exchangedb/exchange-0001.sql +++ b/src/exchangedb/exchange-0001.sql @@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS wire_targets_default    PARTITION OF wire_targets    FOR VALUES WITH (MODULUS 1, REMAINDER 0); --- FIXME partition by serial_id rather than h_payto,  +-- FIXME partition by serial_id rather than h_payto,  -- it is used more in join conditions - crucial for sharding to select this.  -- Author: (Boss Marco)  CREATE INDEX IF NOT EXISTS wire_targets_serial_id_index @@ -108,19 +108,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'reserves' -  ELSE  +  ELSE      'reserves_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (reserve_pub);' -  ELSE  +  ELSE      ';'    END; @@ -189,19 +189,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'reserves_in' -  ELSE  +  ELSE      'reserves_in_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (reserve_pub);' -  ELSE  +  ELSE      ';'    END; @@ -267,19 +267,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'reserves_close' -  ELSE  +  ELSE      'reserves_close_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (reserve_pub);' -  ELSE  +  ELSE      ';'    END; @@ -335,19 +335,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'reserves_out' -  ELSE  +  ELSE      'reserves_out_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (h_blind_ev);' -  ELSE  +  ELSE      ';'    END; @@ -488,19 +488,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'known_coins' -  ELSE  +  ELSE      'known_coins_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (coin_pub);' -- FIXME: or include denominations_serial? or multi-level partitioning? -  ELSE  +  ELSE      ';'    END; @@ -559,19 +559,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'refresh_commitments' -  ELSE  +  ELSE      'refresh_commitments_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (rc);' -  ELSE  +  ELSE      ';'    END; @@ -632,19 +632,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'refresh_revealed_coins' -  ELSE  +  ELSE      'refresh_revealed_coins_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (melt_serial_id);' -  ELSE  +  ELSE      ';'    END; @@ -715,19 +715,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'refresh_transfer_keys' -  ELSE  +  ELSE      'refresh_transfer_keys_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (melt_serial_id);' -  ELSE  +  ELSE      ';'    END; @@ -790,19 +790,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'deposits' -  ELSE  +  ELSE      'deposits_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (shard);' -  ELSE  +  ELSE      ';'    END; @@ -902,19 +902,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'refunds' -  ELSE  +  ELSE      'refunds_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (deposit_serial_id);' -  ELSE  +  ELSE      ';'    END; @@ -969,19 +969,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'wire_out' -  ELSE  +  ELSE      'wire_out_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (wtid_raw);' -  ELSE  +  ELSE      ';'    END; @@ -1037,19 +1037,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'aggregation_tracking' -  ELSE  +  ELSE      'aggregation_tracking_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (deposit_serial_id);' -  ELSE  +  ELSE      ';'    END; @@ -1123,19 +1123,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'recoup' -  ELSE  +  ELSE      'recoup_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (known_coin_id);' -  ELSE  +  ELSE      ';'    END; @@ -1199,19 +1199,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'recoup_refresh' -  ELSE  +  ELSE      'recoup_refresh_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (known_coin_id);' -  ELSE  +  ELSE      ';'    END; @@ -1273,19 +1273,19 @@ DECLARE    partition_str VARCHAR;  BEGIN -  table_name = CASE  +  table_name = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'prewire' -  ELSE  +  ELSE      'prewire_' || shard_suffix    END; -  partition_str = CASE  +  partition_str = CASE    shard_suffix -  WHEN '' THEN  +  WHEN '' THEN      'PARTITION BY HASH (prewire_uuid);' -  ELSE  +  ELSE      ';'    END; @@ -1697,8 +1697,8 @@ IF EXISTS (    SELECT 1      FROM information_Schema.constraint_column_usage     WHERE table_name='wire_out' -     AND constraint_name='wire_out_ref')  -THEN  +     AND constraint_name='wire_out_ref') +THEN    SET CONSTRAINTS wire_out_ref DEFERRED;  END IF; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 2476fcfd..1ee401bc 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1240,6 +1240,7 @@ prepare_statements (struct PostgresClosure *pg)        " aggregation_serial_id"        ",deposits.h_contract_terms"        ",payto_uri" +      ",h_payto"        ",kc.coin_pub"        ",deposits.merchant_pub"        ",wire_out.execution_date" @@ -7160,6 +7161,7 @@ handle_wt_result (void *cls,      uint64_t rowid;      struct TALER_PrivateContractHashP h_contract_terms;      struct TALER_CoinSpendPublicKeyP coin_pub; +    struct TALER_PaytoHashP h_payto;      struct TALER_MerchantPublicKeyP merchant_pub;      struct GNUNET_TIME_Timestamp exec_time;      struct TALER_Amount amount_with_fee; @@ -7172,6 +7174,8 @@ handle_wt_result (void *cls,                                              &h_contract_terms),        GNUNET_PQ_result_spec_string ("payto_uri",                                      &payto_uri), +      GNUNET_PQ_result_spec_auto_from_type ("h_payto", +                                            &h_payto),        TALER_PQ_result_spec_denom_pub ("denom_pub",                                        &denom_pub),        GNUNET_PQ_result_spec_auto_from_type ("coin_pub", @@ -7200,6 +7204,7 @@ handle_wt_result (void *cls,               rowid,               &merchant_pub,               payto_uri, +             &h_payto,               exec_time,               &h_contract_terms,               &denom_pub, diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index a3652a50..497d6140 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -536,6 +536,7 @@ cb_wt_never (void *cls,               uint64_t serial_id,               const struct TALER_MerchantPublicKeyP *merchant_pub,               const char *account_payto_uri, +             const struct TALER_PaytoHashP *h_payto,               struct GNUNET_TIME_Timestamp exec_time,               const struct TALER_PrivateContractHashP *h_contract_terms,               const struct TALER_DenominationPublicKey *denom_pub, @@ -576,6 +577,7 @@ cb_wt_check (void *cls,               uint64_t rowid,               const struct TALER_MerchantPublicKeyP *merchant_pub,               const char *account_payto_uri, +             const struct TALER_PaytoHashP *h_payto,               struct GNUNET_TIME_Timestamp exec_time,               const struct TALER_PrivateContractHashP *h_contract_terms,               const struct TALER_DenominationPublicKey *denom_pub, | 
