fix sharding
This commit is contained in:
parent
5b3a468d38
commit
22ce5bff77
@ -1 +1 @@
|
||||
Subproject commit 8c7d9be40ba627348da3e01b91b4f1d3cc78631f
|
||||
Subproject commit 17555514bd2866e0d45b23e4a1c198415205c8f2
|
@ -319,7 +319,7 @@ parse_wirewatch_config (void)
|
||||
* @param amount_with_fee what was the refunded amount with the fee
|
||||
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
|
||||
*/
|
||||
static int
|
||||
static enum GNUNET_GenericReturnValue
|
||||
refund_by_coin_cb (void *cls,
|
||||
const struct TALER_Amount *amount_with_fee)
|
||||
{
|
||||
@ -768,8 +768,9 @@ run_aggregation (void *cls)
|
||||
|
||||
/* Now try to find other deposits to aggregate */
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Found ready deposit for %s, aggregating\n",
|
||||
TALER_B2S (&au_active.merchant_pub));
|
||||
"Found ready deposit for %s, aggregating by target %llu\n",
|
||||
TALER_B2S (&au_active.merchant_pub),
|
||||
(unsigned long long) au_active.wire_target);
|
||||
qs = db_plugin->iterate_matching_deposits (db_plugin->cls,
|
||||
au_active.wire_target,
|
||||
&au_active.merchant_pub,
|
||||
|
@ -386,7 +386,7 @@ CREATE TABLE IF NOT EXISTS deposits
|
||||
COMMENT ON TABLE deposits
|
||||
IS 'Deposits we have received and for which we need to make (aggregate) wire transfers (and manage refunds).';
|
||||
COMMENT ON COLUMN deposits.shard
|
||||
IS 'Used for load sharding. Should be set based on h_wire, merchant_pub and a service salt. Default of 0 onlyapplies for columns migrated from a previous version without sharding support. 64-bit value because we need an *unsigned* 32-bit value.';
|
||||
IS 'Used for load sharding. Should be set based on h_payto and merchant_pub. Default of 0 onlyapplies for columns migrated from a previous version without sharding support. 64-bit value because we need an *unsigned* 32-bit value.';
|
||||
COMMENT ON COLUMN deposits.wire_target_serial_id
|
||||
IS 'Identifies the target bank account and KYC status';COMMENT ON COLUMN deposits.wire_salt
|
||||
IS 'Salt used when hashing the payto://-URI to get the h_wire';
|
||||
|
@ -5301,7 +5301,7 @@ postgres_get_ready_deposit (void *cls,
|
||||
|
||||
(void) GNUNET_TIME_round_abs (&now);
|
||||
GNUNET_assert (start_shard_row < end_shard_row);
|
||||
GNUNET_assert (end_shard_row <= INT64_MAX);
|
||||
GNUNET_assert (end_shard_row <= INT32_MAX);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Finding ready deposits by deadline %s (%llu)\n",
|
||||
GNUNET_STRINGS_absolute_time_to_string (now),
|
||||
@ -5709,7 +5709,7 @@ postgres_ensure_coin_known (void *cls,
|
||||
static uint64_t
|
||||
compute_shard (const struct TALER_EXCHANGEDB_Deposit *deposit)
|
||||
{
|
||||
uint64_t res;
|
||||
uint32_t res;
|
||||
|
||||
GNUNET_assert (GNUNET_YES ==
|
||||
GNUNET_CRYPTO_kdf (&res,
|
||||
@ -5720,12 +5720,12 @@ compute_shard (const struct TALER_EXCHANGEDB_Deposit *deposit)
|
||||
strlen (deposit->receiver_wire_account),
|
||||
NULL, 0));
|
||||
/* interpret hash result as NBO for platform independence,
|
||||
convert to HBO and map to [0..2^63-1] range */
|
||||
convert to HBO and map to [0..2^31-1] range */
|
||||
res = ntohl (res);
|
||||
if (res > INT64_MAX)
|
||||
res += INT64_MIN;
|
||||
GNUNET_assert (res <= INT64_MAX);
|
||||
return res;
|
||||
if (res > INT32_MAX)
|
||||
res += INT32_MIN;
|
||||
GNUNET_assert (res <= INT32_MAX);
|
||||
return (uint64_t) res;
|
||||
}
|
||||
|
||||
|
||||
@ -5773,7 +5773,7 @@ postgres_insert_deposit (void *cls,
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
GNUNET_assert (shard <= INT64_MAX);
|
||||
GNUNET_assert (shard <= INT32_MAX);
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||
"Inserting deposit to be executed at %s (%llu/%llu)\n",
|
||||
GNUNET_STRINGS_absolute_time_to_string (deposit->wire_deadline),
|
||||
|
@ -1864,7 +1864,7 @@ run (void *cls)
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->get_ready_deposit (plugin->cls,
|
||||
0,
|
||||
INT64_MAX,
|
||||
INT32_MAX,
|
||||
&deposit_cb,
|
||||
&deposit));
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
@ -1885,14 +1885,14 @@ run (void *cls)
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
|
||||
plugin->get_ready_deposit (plugin->cls,
|
||||
0,
|
||||
INT64_MAX,
|
||||
INT32_MAX,
|
||||
&deposit_cb,
|
||||
&deposit));
|
||||
plugin->rollback (plugin->cls);
|
||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||
plugin->get_ready_deposit (plugin->cls,
|
||||
0,
|
||||
INT64_MAX,
|
||||
INT32_MAX,
|
||||
&deposit_cb,
|
||||
&deposit));
|
||||
FAILIF (GNUNET_OK !=
|
||||
|
@ -213,26 +213,35 @@ run (void *cls,
|
||||
* happen here, as each deposit operation is run with a
|
||||
* fresh merchant public key! NOTE: this comment comes
|
||||
* "verbatim" from the old test-suite, and IMO does not explain
|
||||
* a lot!*///
|
||||
* a lot! */
|
||||
CMD_EXEC_AGGREGATOR ("run-aggregator"),
|
||||
|
||||
/**
|
||||
* Check all the transfers took place.
|
||||
*/
|
||||
TALER_TESTING_cmd_check_bank_transfer
|
||||
("check_bank_transfer-499c", ec.exchange_url,
|
||||
"EUR:4.98", bc.exchange_payto, bc.user42_payto),
|
||||
TALER_TESTING_cmd_check_bank_transfer
|
||||
("check_bank_transfer-99c1", ec.exchange_url,
|
||||
"EUR:0.98", bc.exchange_payto, bc.user42_payto),
|
||||
TALER_TESTING_cmd_check_bank_transfer
|
||||
("check_bank_transfer-99c", ec.exchange_url,
|
||||
"EUR:0.08", bc.exchange_payto, bc.user43_payto),
|
||||
TALER_TESTING_cmd_check_bank_transfer (
|
||||
"check_bank_transfer-499c",
|
||||
ec.exchange_url,
|
||||
"EUR:4.98",
|
||||
bc.exchange_payto,
|
||||
bc.user42_payto),
|
||||
TALER_TESTING_cmd_check_bank_transfer (
|
||||
"check_bank_transfer-99c1",
|
||||
ec.exchange_url,
|
||||
"EUR:0.98",
|
||||
bc.exchange_payto,
|
||||
bc.user42_payto),
|
||||
TALER_TESTING_cmd_check_bank_transfer (
|
||||
"check_bank_transfer-99c",
|
||||
ec.exchange_url,
|
||||
"EUR:0.08",
|
||||
bc.exchange_payto,
|
||||
bc.user43_payto),
|
||||
|
||||
/* The following transactions got originated within
|
||||
* the "massive deposit confirms" batch. */
|
||||
TALER_TESTING_cmd_check_bank_transfer
|
||||
("check-massive-transfer-1",
|
||||
TALER_TESTING_cmd_check_bank_transfer (
|
||||
"check-massive-transfer-1",
|
||||
ec.exchange_url,
|
||||
"EUR:0.98",
|
||||
bc.exchange_payto, bc.user43_payto),
|
||||
@ -412,7 +421,8 @@ run (void *cls,
|
||||
* These commands should close the reserve because the aggregator
|
||||
* is given a config file that overrides the reserve expiration
|
||||
* time (making it now-ish)
|
||||
*/CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve",
|
||||
*/
|
||||
CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve",
|
||||
"EUR:5.01"),
|
||||
TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation",
|
||||
CONFIG_FILE_EXPIRE_RESERVE_NOW),
|
||||
@ -472,8 +482,8 @@ run (void *cls,
|
||||
*/
|
||||
CMD_TRANSFER_TO_EXCHANGE ("massive-reserve",
|
||||
"EUR:10.10"),
|
||||
TALER_TESTING_cmd_check_bank_admin_transfer
|
||||
("check-massive-transfer",
|
||||
TALER_TESTING_cmd_check_bank_admin_transfer (
|
||||
"check-massive-transfer",
|
||||
"EUR:10.10",
|
||||
bc.user42_payto, bc.exchange_payto,
|
||||
"massive-reserve"),
|
||||
@ -518,8 +528,8 @@ run (void *cls,
|
||||
"massive-reserve",
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_deposit
|
||||
("massive-deposit-1",
|
||||
TALER_TESTING_cmd_deposit (
|
||||
"massive-deposit-1",
|
||||
"massive-withdraw-1",
|
||||
0,
|
||||
bc.user43_payto,
|
||||
@ -599,8 +609,8 @@ run (void *cls,
|
||||
GNUNET_TIME_UNIT_ZERO,
|
||||
"EUR:1",
|
||||
MHD_HTTP_OK),
|
||||
TALER_TESTING_cmd_deposit
|
||||
("massive-deposit-10",
|
||||
TALER_TESTING_cmd_deposit (
|
||||
"massive-deposit-10",
|
||||
"massive-withdraw-10",
|
||||
0,
|
||||
bc.user43_payto,
|
||||
|
Loading…
Reference in New Issue
Block a user