Merge branch 'master' of ssh://taler.net:/var/git/mint

This commit is contained in:
Christian Grothoff 2015-08-12 15:36:06 +02:00
commit 891a004385
4 changed files with 87 additions and 24 deletions

View File

@ -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"),

View File

@ -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;
}
}

View File

@ -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, \

View File

@ -363,10 +363,10 @@ postgres_create_tables (void *cls,
",oldcoin_index INT2 NOT NULL"
",coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)"
",amount_with_fee_val INT8 NOT NULL"
",amount_with_fee_frac INT8 NOT NULL"
",amount_with_fee_frac INT4 NOT NULL"
",amount_with_fee_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
",melt_fee_val INT8 NOT NULL"
",melt_fee_frac INT8 NOT NULL"
",melt_fee_frac INT4 NOT NULL"
",melt_fee_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
",PRIMARY KEY (session_hash, oldcoin_index)" /* a coin can be used only
once in a refresh session */