aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-11 16:01:28 +0200
committerFournier Nicolas <nicolas.fournier@ensta-paristech.fr>2015-08-11 16:01:28 +0200
commit09350380878fa3637378e77631c7f05e731f59f8 (patch)
treeb1c927a5641dcf619b2c452ec6c75c2450c4a557
parent762676bd2c42286a38dfe13c287bac048643470d (diff)
parenta6fb64ae7277fbb0eb44a1e81bbc5923ed9971e4 (diff)
Merge remote-tracking branch 'refs/remotes/origin/master'
-rw-r--r--src/mintdb/perf_taler_mintdb.c41
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.c66
-rw-r--r--src/mintdb/perf_taler_mintdb_interpreter.h4
3 files changed, 87 insertions, 24 deletions
diff --git a/src/mintdb/perf_taler_mintdb.c b/src/mintdb/perf_taler_mintdb.c
index 80cb3069e..56ba34bbe 100644
--- a/src/mintdb/perf_taler_mintdb.c
+++ b/src/mintdb/perf_taler_mintdb.c
@@ -25,8 +25,8 @@
#define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15
-#define BIGGER 100000
-#define BIG 10000
+#define BIGGER 10
+#define BIG 10
#define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG
@@ -50,7 +50,7 @@ main (int argc, char ** argv)
int ret;
struct PERF_TALER_MINTDB_Cmd benchmark[] =
{
- // Denomination used to create coins
+ /* Denomination used to create coins */
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Initializing database"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
@@ -66,8 +66,8 @@ main (int argc, char ** argv)
NB_DENOMINATION_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - end",
"01 - denomination loop"),
- // End of initialization
- // Reserve initialization
+ /* End of initialization */
+ /* Reserve initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
NB_RESERVE_INIT),
PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
@@ -79,8 +79,8 @@ main (int argc, char ** argv)
NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - end",
"02 - init reserve loop"),
- // End reserve init
- // Withdrawal initialization
+ /* End reserve init */
+ /* Withdrawal initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop",
NB_WITHDRAW_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
@@ -102,8 +102,8 @@ main (int argc, char ** argv)
NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - end",
"03 - init withdraw loop"),
- //End of withdrawal initialization
- //Deposit initialization
+ /*End of withdrawal initialization */
+ /*Deposit initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop",
NB_DEPOSIT_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
@@ -121,8 +121,8 @@ main (int argc, char ** argv)
NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"04 - deposit init loop"),
- // End of deposit initialization
- // Session initialization
+ /* End of deposit initialization */
+ /* Session initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - refresh session init loop",
NB_REFRESH_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
@@ -134,7 +134,24 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("05 - end",
"05 - refresh session init loop"),
-
+ /* End of refresh session initialization */
+ /* Refresh melt initialization */
+ PERF_TALER_MINTDB_INIT_CMD_LOOP ("06 - refresh melt init loop",
+ NB_REFRESH_INIT),
+ PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - session hash",
+ "06 - refresh melt init loop",
+ "05 - session array"),
+ PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - coin",
+ "06 - refresh melt init loop",
+ "03 - save coin"),
+ PERF_TALER_MINTDB_INIT_CMD_INSERT_REFRESH_MELT ("06 - refresh melt",
+ "06 - session hash",
+ "06 - coin"),
+ PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
+ PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("06 - end",
+ "06 - refresh melt init loop"),
+ /* End of refresh melt initialization */
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("End of initialization"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"),
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c
index 8db141f67..708eac809 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.c
+++ b/src/mintdb/perf_taler_mintdb_interpreter.c
@@ -747,9 +747,10 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION:
{
int ret;
+
ret = cmd_find (cmd,
cmd[i].details.get_refresh_session.label_hash);
- if (GNUNET_SYSERR != ret)
+ if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
@@ -769,12 +770,56 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
}
break;
+ case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT:
+ {
+ int ret;
+
+ ret = cmd_find (cmd,
+ cmd[i].details.insert_refresh_melt.label_hash);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_melt.label_hash);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_MINTDB_REFRESH_HASH != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_melt.label_hash);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_refresh_melt.index_hash = ret;
+ ret = cmd_find (cmd,
+ cmd[i].details.insert_refresh_melt.label_coin);
+ if (GNUNET_SYSERR == ret)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Undefined reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_melt.label_coin);
+ return GNUNET_SYSERR;
+ }
+ if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d:Wrong type reference to %s\n",
+ i,
+ cmd[i].details.insert_refresh_melt.label_coin);
+ return GNUNET_SYSERR;
+ }
+ cmd[i].details.insert_refresh_melt.index_coin = ret; }
+ break;
+
case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_refresh_melt.label_hash);
- if (GNUNET_SYSERR != ret)
+ if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
@@ -1328,6 +1373,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{
int hash_index;
int coin_index;
+ int ret;
struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt *melt;
struct PERF_TALER_MINTDB_Coin *coin;
@@ -1338,11 +1384,11 @@ 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);
- state->plugin->insert_refresh_melt (state->plugin->cls,
+ ret = state->plugin->insert_refresh_melt (state->plugin->cls,
state->session,
1,
melt);
- state->cmd[state->i].exposed.data.session_hash = hash;
+ GNUNET_assert (GNUNET_SYSERR != ret);
}
break;
@@ -1588,14 +1634,14 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error parsing configuration file");
+ "Error parsing configuration file\n");
return GNUNET_SYSERR;
}
plugin = TALER_MINTDB_plugin_load (config);
if (NULL == plugin)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error connectiong to the database");
+ "Error connectiong to the database\n");
return ret;
}
ret = plugin->create_tables (plugin->cls,
@@ -1603,7 +1649,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error while creating the database architecture");
+ "Error while creating the database architecture\n");
return ret;
}
/*
@@ -1618,7 +1664,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error during database initialization");
+ "Error during database initialization\n");
return ret;
}
/*
@@ -1629,7 +1675,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error while runing the benchmark");
+ "Error while runing the benchmark\n");
return ret;
}
/* Drop tables */
@@ -1643,7 +1689,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error removing cleaning the database");
+ "Error cleaning the database\n");
return ret;
}
}
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.h b/src/mintdb/perf_taler_mintdb_interpreter.h
index 5f982cbd9..f4365f5d8 100644
--- a/src/mintdb/perf_taler_mintdb_interpreter.h
+++ b/src/mintdb/perf_taler_mintdb_interpreter.h
@@ -474,7 +474,7 @@
{ \
.command = PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION, \
.label = _label, \
- .exposed.type = PERF_TALER_MINTDB_REFRESH_MELT \
+ .exposed.type = PERF_TALER_MINTDB_NONE \
}
/**
@@ -486,7 +486,7 @@
*/
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_REFRESH_MELT(_label, \
_label_hash, \
- _label_coin), \
+ _label_coin) \
{ \
.command = PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT, \
.label = _label, \