aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-13 09:22:38 +0200
committerFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-13 09:22:38 +0200
commitb456400ab2a040063e6f85553c918908b3699d73 (patch)
tree0a48d8681ecc06836bac05274b196e790950f0bb
parentd238b9d3986a0fde6e42626c9b966eb70f6004ea (diff)
fixes for melt insertion
-rw-r--r--src/mintdb/perf_taler_mintdb.c194
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c67
2 files changed, 143 insertions, 118 deletions
diff --git a/src/mintdb/perf_taler_mintdb.c b/src/mintdb/perf_taler_mintdb.c
index 358629a95..88e2b5a59 100644
--- a/src/mintdb/perf_taler_mintdb.c
+++ b/src/mintdb/perf_taler_mintdb.c
@@ -25,8 +25,9 @@
#define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15
-#define BIGGER 100000
-#define BIG 10000
+#define SMALL 10
+#define BIG 100
+#define BIGGER 1000
#define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG
@@ -40,6 +41,9 @@
#define NB_REFRESH_INIT BIGGER
#define NB_REFRESH_SAVE BIG
+#define NB_MELT_INIT BIG
+#define NB_MELT_SAVE SMALL
+
/**
* Runs the performances tests for the mint database
* and logs the results using Gauger
@@ -137,7 +141,7 @@ main (int argc, char ** argv)
/* End of refresh session initialization */
/* Refresh melt initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("06 - refresh melt init loop",
- NB_REFRESH_INIT),
+ NB_MELT_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - session hash",
"06 - refresh melt init loop",
@@ -155,58 +159,58 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - reserve insert measure",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("21 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("21 - reserve insert measure",
NB_RESERVE_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("05 - reserve"),
- PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("05 - insert",
- "05 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("21 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("21 - insert",
+ "21 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "05 - reserve insert measure"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - stop"),
- PERF_TALER_MINTDB_INIT_CMD_GAUGER ("05 - gauger",
- "05 - start",
- "05 - stop",
+ "21 - reserve insert measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("21 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("21 - gauger",
+ "21 - start",
+ "21 - stop",
"POSTGRES",
"Number of reserve inserted per second",
"item/sec",
NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve insertion"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("06 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("06 - reserve load measure",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("22 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("22 - reserve load measure",
NB_RESERVE_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - reserve",
- "06 - reserve load measure",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("22 - reserve",
+ "22 - reserve load measure",
"02 - save reserve"),
- PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE ("06 - get",
- "06 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE ("22 - get",
+ "22 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "06 - reserve load measure"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("06 - stop"),
+ "22 - reserve load measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("22 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "06 - start",
- "06 - stop",
+ "22 - start",
+ "22 - stop",
"POSTGRES",
"Number of reserve loaded per second",
"item/sec",
NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve retreival"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("07 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("07 - reserve history measure",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("23 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("23 - reserve history measure",
NB_RESERVE_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("07 - reserve",
- "07 - reserve history measure",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("23 - reserve",
+ "23 - reserve history measure",
"02 - save reserve"),
PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY ("",
- "07 - reserve"),
+ "23 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "07 - reserve history measure"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("07 - stop"),
+ "23 - reserve history measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("23 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "07 - start",
- "07 - stop",
+ "23 - start",
+ "23 - stop",
"POSTGRES",
"Number of reserve history loaded per second",
"item/sec",
@@ -214,114 +218,130 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of reserve history access"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("08 - withdraw insert measure",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("24 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("24 - withdraw insert measure",
NB_WITHDRAW_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - reserve",
- "08 - withdraw insert measure",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("24 - reserve",
+ "24 - withdraw insert measure",
"02 - save reserve"),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - denomination",
- "08 - withdraw insert measure",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("24 - denomination",
+ "24 - withdraw insert measure",
"01 - save denomination"),
- PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW ("08 - withdraw",
- "08 - denomination",
- "08 - reserve"),
- PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("08 - insert",
- "08 - withdraw"),
+ PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW ("24 - withdraw",
+ "24 - denomination",
+ "24 - reserve"),
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("24 - insert",
+ "24 - withdraw"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "08 - withdraw insert measure"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - stop"),
+ "24 - withdraw insert measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("24 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "08 - start",
- "08 - stop",
+ "24 - start",
+ "24 - stop",
"POSTGRES",
"Number of withdraw insert per second",
"item/sec",
NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of withdraw insertion"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("09 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("09 - withdraw insert measure",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("25 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("25 - withdraw insert measure",
NB_RESERVE_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("09 - coin",
- "09 - withdraw insert measure",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("25 - coin",
+ "25 - withdraw insert measure",
"03 - save coin"),
PERF_TALER_MINTDB_INIT_CMD_GET_WITHDRAW ("",
- "09 - coin"),
+ "25 - coin"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "09 - withdraw insert measure"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("09 - stop"),
+ "25 - withdraw insert measure"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("25 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "09 - start",
- "09 - stop",
+ "25 - start",
+ "25 - stop",
"POSTGRES",
"Number of withdraw loaded per second",
"item/sec",
NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of withdraw loading"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("10 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("10 - get coin transaction",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("26 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("26 - get coin transaction",
NB_WITHDRAW_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("10 - coin",
- "10 - get coin transaction",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("26 - coin",
+ "26 - get coin transaction",
"03 - save coin"),
PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION("",
- "10 - coin"),
+ "26 - coin"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "10 - get coin transaction"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("10 - end"),
+ "26 - get coin transaction"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("26 - end"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "10 - start",
- "10 - end",
+ "26 - start",
+ "26 - end",
"POSTGRES",
"Number of coin transaction history loaded per second",
"item/sec",
NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of transaction loading"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("11 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("11 - /withdraw/sign",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("27 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("27 - /withdraw/sign",
NB_WITHDRAW_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("11 - reserve",
- "11 - /withdraw/sign",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("27 - reserve",
+ "27 - /withdraw/sign",
"02 - save reserve"),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("11 - dki",
- "11 - /withdraw/sign",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("27 - dki",
+ "27 - /withdraw/sign",
"01 - save denomination"),
PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN ("",
- "11 - dki",
- "11 - reserve"),
+ "27 - dki",
+ "27 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "11 - /withdraw/sign"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("11 - end"),
+ "27 - /withdraw/sign"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("27 - end"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "11 - start",
- "11 - end",
+ "27 - start",
+ "27 - end",
"POSTGRES",
"Number of /withdraw/sign per second",
"item/sec",
NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of /withdraw/sign"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - start"),
- PERF_TALER_MINTDB_INIT_CMD_LOOP ("12 - /deposit",
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("28 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("28 - /deposit",
NB_DEPOSIT_SAVE),
- PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("12 - coin",
- "12 - /deposit",
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("28 - coin",
+ "28 - /deposit",
"03 - save coin"),
- PERF_TALER_MINTDB_INIT_CMD_DEPOSIT ("12 - deposit",
- "12 - coin"),
+ PERF_TALER_MINTDB_INIT_CMD_DEPOSIT ("28 - deposit",
+ "28 - coin"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
- "12 - /deposit"),
- PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("12 - stop"),
+ "28 - /deposit"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("28 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
- "12 - start",
- "12 - stop",
+ "28 - start",
+ "28 - stop",
"POSTGRES",
"Number of /deposit per second",
"item/sec",
NB_DEPOSIT_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("29 - start"),
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("29 - insert refresh session",
+ NB_REFRESH_SAVE),
+ PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
+ PERF_TALER_MINTDB_INIT_CMD_CREATE_REFRESH_SESSION (""),
+ PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
+ "29 - insert refresh session"),
+ PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("29 - stop"),
+ PERF_TALER_MINTDB_INIT_CMD_GAUGER ("",
+ "29 - start",
+ "29 - stop",
+ "POSTGRES",
+ "Number of refresh session inserted per second",
+ "item/sec",
+ NB_REFRESH_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END (""),
};
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index 708eac809..686c43fce 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -1141,14 +1141,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
{
int deposit_index;
+ int ret;
struct TALER_MINTDB_Deposit *deposit;
deposit_index = state->cmd[state->i].details.insert_deposit.index_deposit;
deposit = state->cmd[deposit_index].exposed.data.deposit;
- GNUNET_assert (GNUNET_OK ==
- state->plugin->insert_deposit (state->plugin->cls,
+ ret = state->plugin->insert_deposit (state->plugin->cls,
state->session,
- deposit));
+ deposit);
+ GNUNET_assert (GNUNET_SYSERR != ret);
state->cmd[state->i].exposed.data.deposit = deposit;
}
break;
@@ -1156,13 +1157,15 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
{
unsigned int source_index;
+ int ret;
struct PERF_TALER_MINTDB_Data *data;
source_index = state->cmd[state->i].details.get_deposit.index_deposit;
data = &state->cmd[source_index].exposed;
- state->plugin->have_deposit (state->plugin->cls,
- state->session,
- data->data.deposit);
+ ret = state->plugin->have_deposit (state->plugin->cls,
+ state->session,
+ data->data.deposit);
+ GNUNET_assert (GNUNET_SYSERR != ret);
}
break;
@@ -1178,6 +1181,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_INSERT_RESERVE:
{
unsigned int reserve_index;
+ int ret;
struct PERF_TALER_MINTDB_Reserve *reserve;
json_t *details = NULL;
@@ -1188,21 +1192,20 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
GNUNET_CRYPTO_QUALITY_WEAK,
UINT32_MAX));
GNUNET_assert (NULL != details);
- state->plugin->reserves_in_insert (
- state->plugin->cls,
- state->session,
- &reserve->reserve.pub,
- &reserve->reserve.balance,
- GNUNET_TIME_absolute_get (),
- details
- );
+ ret = state->plugin->reserves_in_insert (state->plugin->cls,
+ state->session,
+ &reserve->reserve.pub,
+ &reserve->reserve.balance,
+ GNUNET_TIME_absolute_get (),
+ details);
+ GNUNET_assert (GNUNET_SYSERR != ret);
json_decref (details);
}
break;
case PERF_TALER_MINTDB_CMD_GET_RESERVE:
{
- int reserve_index;
+ unsigned int reserve_index;
int ret;
struct PERF_TALER_MINTDB_Data *data;
@@ -1218,7 +1221,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY:
{
- int reserve_index;
+ unsigned int reserve_index;
struct TALER_MINTDB_ReserveHistory *history;
struct PERF_TALER_MINTDB_Data *data;
@@ -1237,6 +1240,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{
struct TALER_MINTDB_DenominationKeyIssueInformation *dki =
PERF_TALER_MINTDB_denomination_init ();
+ GNUNET_assert (NULL != dki);
state->cmd[state->i].exposed.data.dki = dki;
}
break;
@@ -1275,7 +1279,8 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_CREATE_WITHDRAW:
{
- int dki_index, reserve_index;
+ unsigned int dki_index;
+ unsigned int reserve_index;
struct PERF_TALER_MINTDB_Coin *coin ;
dki_index = state->cmd[state->i].details.create_withdraw.index_dki;
@@ -1371,9 +1376,8 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT:
{
- int hash_index;
- int coin_index;
- int ret;
+ unsigned int hash_index;
+ unsigned int coin_index;
struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt *melt;
struct PERF_TALER_MINTDB_Coin *coin;
@@ -1384,28 +1388,29 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
coin = state->cmd[coin_index].exposed.data.coin;
melt = PERF_TALER_MINTDB_refresh_melt_init (hash,
coin);
- ret = state->plugin->insert_refresh_melt (state->plugin->cls,
- state->session,
- 1,
- melt);
- GNUNET_assert (GNUNET_SYSERR != ret);
+ state->plugin->insert_refresh_melt (state->plugin->cls,
+ state->session,
+ 1,
+ melt);
}
break;
case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
{
- int hash_index;
+ int ret;
+ unsigned int hash_index;
struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt melt;
hash_index = cmd_find (state->cmd,
state->cmd[state->i].details.get_refresh_melt.label_hash);
hash = state->cmd[hash_index].exposed.data.session_hash;
- state->plugin->get_refresh_melt (state->plugin->cls,
- state->session,
- hash,
- 1,
- &melt);
+ ret = state->plugin->get_refresh_melt (state->plugin->cls,
+ state->session,
+ hash,
+ 1,
+ &melt);
+ GNUNET_assert (GNUNET_SYSERR != ret);
}
break;