fix ftbfs

This commit is contained in:
Fournier Nicolas 2015-08-11 15:52:40 +02:00
parent 13619f425c
commit a6fb64ae72
3 changed files with 87 additions and 24 deletions

View File

@ -25,8 +25,8 @@
#define NB_DENOMINATION_INIT 15 #define NB_DENOMINATION_INIT 15
#define NB_DENOMINATION_SAVE 15 #define NB_DENOMINATION_SAVE 15
#define BIGGER 100000 #define BIGGER 10
#define BIG 10000 #define BIG 10
#define NB_RESERVE_INIT BIGGER #define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG #define NB_RESERVE_SAVE BIG
@ -50,7 +50,7 @@ main (int argc, char ** argv)
int ret; int ret;
struct PERF_TALER_MINTDB_Cmd benchmark[] = 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_DEBUG ("Initializing database"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
@ -66,8 +66,8 @@ main (int argc, char ** argv)
NB_DENOMINATION_SAVE), NB_DENOMINATION_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - end", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - end",
"01 - denomination loop"), "01 - denomination loop"),
// End of initialization /* End of initialization */
// Reserve initialization /* Reserve initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
NB_RESERVE_INIT), NB_RESERVE_INIT),
PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"), PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
@ -79,8 +79,8 @@ main (int argc, char ** argv)
NB_RESERVE_SAVE), NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - end", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - end",
"02 - init reserve loop"), "02 - init reserve loop"),
// End reserve init /* End reserve init */
// Withdrawal initialization /* Withdrawal initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("03 - init withdraw loop",
NB_WITHDRAW_INIT), NB_WITHDRAW_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
@ -102,8 +102,8 @@ main (int argc, char ** argv)
NB_WITHDRAW_SAVE), NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - end", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - end",
"03 - init withdraw loop"), "03 - init withdraw loop"),
//End of withdrawal initialization /*End of withdrawal initialization */
//Deposit initialization /*Deposit initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("04 - deposit init loop",
NB_DEPOSIT_INIT), NB_DEPOSIT_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
@ -121,8 +121,8 @@ main (int argc, char ** argv)
NB_DEPOSIT_SAVE), NB_DEPOSIT_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"04 - deposit init loop"), "04 - deposit init loop"),
// End of deposit initialization /* End of deposit initialization */
// Session initialization /* Session initialization */
PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - refresh session init loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - refresh session init loop",
NB_REFRESH_INIT), NB_REFRESH_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""), 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_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("05 - end", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("05 - end",
"05 - refresh session init loop"), "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 ("End of initialization"),
PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"), PERF_TALER_MINTDB_INIT_CMD_DEBUG ("Start of performances measuring"),

View File

@ -747,9 +747,10 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION: case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION:
{ {
int ret; int ret;
ret = cmd_find (cmd, ret = cmd_find (cmd,
cmd[i].details.get_refresh_session.label_hash); cmd[i].details.get_refresh_session.label_hash);
if (GNUNET_SYSERR != ret) if (GNUNET_SYSERR == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n", "%d:Undefined reference to %s\n",
@ -769,12 +770,56 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
} }
break; 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: case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT:
{ {
int ret; int ret;
ret = cmd_find (cmd, ret = cmd_find (cmd,
cmd[i].details.get_refresh_melt.label_hash); cmd[i].details.get_refresh_melt.label_hash);
if (GNUNET_SYSERR != ret) if (GNUNET_SYSERR == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n", "%d:Undefined reference to %s\n",
@ -1328,6 +1373,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
{ {
int hash_index; int hash_index;
int coin_index; int coin_index;
int ret;
struct GNUNET_HashCode *hash; struct GNUNET_HashCode *hash;
struct TALER_MINTDB_RefreshMelt *melt; struct TALER_MINTDB_RefreshMelt *melt;
struct PERF_TALER_MINTDB_Coin *coin; 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; coin = state->cmd[coin_index].exposed.data.coin;
melt = PERF_TALER_MINTDB_refresh_melt_init (hash, melt = PERF_TALER_MINTDB_refresh_melt_init (hash,
coin); coin);
state->plugin->insert_refresh_melt (state->plugin->cls, ret = state->plugin->insert_refresh_melt (state->plugin->cls,
state->session, state->session,
1, 1,
melt); melt);
state->cmd[state->i].exposed.data.session_hash = hash; GNUNET_assert (GNUNET_SYSERR != ret);
} }
break; break;
@ -1588,14 +1634,14 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error parsing configuration file"); "Error parsing configuration file\n");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
plugin = TALER_MINTDB_plugin_load (config); plugin = TALER_MINTDB_plugin_load (config);
if (NULL == plugin) if (NULL == plugin)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error connectiong to the database"); "Error connectiong to the database\n");
return ret; return ret;
} }
ret = plugin->create_tables (plugin->cls, ret = plugin->create_tables (plugin->cls,
@ -1603,7 +1649,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error while creating the database architecture"); "Error while creating the database architecture\n");
return ret; return ret;
} }
/* /*
@ -1618,7 +1664,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error during database initialization"); "Error during database initialization\n");
return ret; return ret;
} }
/* /*
@ -1629,7 +1675,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error while runing the benchmark"); "Error while runing the benchmark\n");
return ret; return ret;
} }
/* Drop tables */ /* Drop tables */
@ -1643,7 +1689,7 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error removing cleaning the database"); "Error cleaning the database\n");
return ret; return ret;
} }
} }

View File

@ -474,7 +474,7 @@
{ \ { \
.command = PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION, \ .command = PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION, \
.label = _label, \ .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, \ #define PERF_TALER_MINTDB_INIT_CMD_INSERT_REFRESH_MELT(_label, \
_label_hash, \ _label_hash, \
_label_coin), \ _label_coin) \
{ \ { \
.command = PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT, \ .command = PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT, \
.label = _label, \ .label = _label, \