fixing #4462: avoid temporary schemata altogether

This commit is contained in:
Christian Grothoff 2016-05-02 06:36:58 +02:00
parent 53e7547aaf
commit 1cbba4bec1
13 changed files with 83 additions and 140 deletions

View File

@ -23,7 +23,7 @@ Overrides WIREFORMAT option from the configuation file.
Print short help on options. Print short help on options.
.B .B
.IP "\-t, \-\-test" .IP "\-t, \-\-test"
Run in test mode (use temporary tables). Only useful for testcases. Run in test mode and exit when idle.
.B .B
.IP "\-v, \-\-version" .IP "\-v, \-\-version"
Print version information. Print version information.

View File

@ -54,8 +54,7 @@ run (void *cls,
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
plugin->create_tables (plugin->cls, plugin->create_tables (plugin->cls))
GNUNET_NO))
{ {
fprintf (stderr, fprintf (stderr,
"Failed to initialize database.\n"); "Failed to initialize database.\n");

View File

@ -73,8 +73,7 @@ run_transaction (const struct TALER_ReservePublicKeyP *reserve_pub,
int ret; int ret;
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
session = plugin->get_session (plugin->cls, session = plugin->get_session (plugin->cls);
GNUNET_NO);
if (NULL == session) if (NULL == session)
{ {
fprintf (stderr, fprintf (stderr,

View File

@ -173,7 +173,7 @@ static struct AggregationUnit *au;
static int global_ret; static int global_ret;
/** /**
* #GNUNET_YES if we are in test mode and are using temporary tables. * #GNUNET_YES if we are in test mode and should exit when idle.
*/ */
static int test_mode; static int test_mode;
@ -518,8 +518,7 @@ run_aggregation (void *cls)
return; return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for ready deposits to aggregate\n"); "Checking for ready deposits to aggregate\n");
if (NULL == (session = db_plugin->get_session (db_plugin->cls, if (NULL == (session = db_plugin->get_session (db_plugin->cls)))
test_mode)))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n"); "Failed to obtain database session!\n");
@ -891,8 +890,7 @@ run_transfers (void *cls)
tc = GNUNET_SCHEDULER_get_task_context (); tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return; return;
if (NULL == (session = db_plugin->get_session (db_plugin->cls, if (NULL == (session = db_plugin->get_session (db_plugin->cls)))
test_mode)))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n"); "Failed to obtain database session!\n");
@ -987,7 +985,7 @@ main (int argc,
"wireformat to use, overrides WIREFORMAT option in [exchange] section", 1, "wireformat to use, overrides WIREFORMAT option in [exchange] section", 1,
&GNUNET_GETOPT_set_filename, &exchange_wireformat}, &GNUNET_GETOPT_set_filename, &exchange_wireformat},
{'t', "test", NULL, {'t', "test", NULL,
"run in test mode with temporary tables", 0, "run in test mode and exit when idle", 0,
&GNUNET_GETOPT_set_one, &test_mode}, &GNUNET_GETOPT_set_one, &test_mode},
GNUNET_GETOPT_OPTION_VERSION (VERSION "-" VCS_VERSION), GNUNET_GETOPT_OPTION_VERSION (VERSION "-" VCS_VERSION),
GNUNET_GETOPT_OPTION_END GNUNET_GETOPT_OPTION_END

View File

@ -80,11 +80,6 @@ struct TALER_MasterPublicKeyP TMH_master_public_key;
*/ */
struct TALER_EXCHANGEDB_Plugin *TMH_plugin; struct TALER_EXCHANGEDB_Plugin *TMH_plugin;
/**
* Are we running in test mode?
*/
int TMH_test_mode;
/** /**
* Default timeout in seconds for HTTP requests. * Default timeout in seconds for HTTP requests.
*/ */
@ -466,9 +461,7 @@ exchange_serve_process_config ()
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Running in TEST mode! Database contents will not persist!\n"); "Running in TEST mode! Database contents will not persist!\n");
TMH_test_mode = GNUNET_YES; TMH_plugin->create_tables (TMH_plugin->cls);
TMH_plugin->create_tables (TMH_plugin->cls,
GNUNET_YES);
} }
{ {
@ -906,19 +899,6 @@ main (int argc,
MHD_stop_daemon (mydaemon); MHD_stop_daemon (mydaemon);
break; break;
} }
if (GNUNET_YES == TMH_test_mode)
{
struct TALER_EXCHANGEDB_Session *session;
session = TMH_plugin->get_session (TMH_plugin->cls,
GNUNET_YES);
if (NULL == session)
GNUNET_break (0);
else
TMH_plugin->drop_temporary (TMH_plugin->cls,
session);
}
TALER_EXCHANGEDB_plugin_unload (TMH_plugin); TALER_EXCHANGEDB_plugin_unload (TMH_plugin);
TMH_VALIDATION_done (); TMH_VALIDATION_done ();
return (GNUNET_SYSERR == ret) ? 1 : 0; return (GNUNET_SYSERR == ret) ? 1 : 0;

View File

@ -43,11 +43,6 @@ extern int TMH_exchange_connection_close;
*/ */
extern struct GNUNET_CONFIGURATION_Handle *cfg; extern struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Are we running in test mode?
*/
extern int TMH_test_mode;
/** /**
* Main directory with exchange data. * Main directory with exchange data.
*/ */

View File

@ -160,8 +160,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
int ret; int ret;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -278,8 +277,7 @@ TMH_DB_execute_reserve_status (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_ReserveHistory *rh; struct TALER_EXCHANGEDB_ReserveHistory *rh;
int res; int res;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -524,8 +522,7 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection,
GNUNET_CRYPTO_hash (blinded_msg, GNUNET_CRYPTO_hash (blinded_msg,
blinded_msg_len, blinded_msg_len,
&h_blind); &h_blind);
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -725,8 +722,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection,
int res; int res;
unsigned int i; unsigned int i;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -1237,8 +1233,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection,
unsigned int j; unsigned int j;
unsigned int off; unsigned int off;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -1465,8 +1460,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
int res; int res;
unsigned int i; unsigned int i;
if (NULL == (ctx.session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (ctx.session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -1528,8 +1522,7 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
int ret; int ret;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -1713,8 +1706,7 @@ TMH_DB_execute_wire_deposits (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
struct TMH_WireDepositDetail *wdd; struct TMH_WireDepositDetail *wdd;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);
@ -1879,8 +1871,7 @@ TMH_DB_execute_deposit_wtid (struct MHD_Connection *connection,
struct DepositWtidContext ctx; struct DepositWtidContext ctx;
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
TMH_test_mode)))
{ {
GNUNET_break (0); GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_internal_db_error (connection);

View File

@ -250,8 +250,7 @@ reload_keys_denom_iter (void *cls,
GNUNET_CRYPTO_hash_context_read (ctx->hash_context, GNUNET_CRYPTO_hash_context_read (ctx->hash_context,
&denom_key_hash, &denom_key_hash,
sizeof (struct GNUNET_HashCode)); sizeof (struct GNUNET_HashCode));
session = TMH_plugin->get_session (TMH_plugin->cls, session = TMH_plugin->get_session (TMH_plugin->cls);
TMH_test_mode);
if (NULL == session) if (NULL == session)
return GNUNET_SYSERR; return GNUNET_SYSERR;
/* Try to insert DKI into DB until we succeed; note that if the DB /* Try to insert DKI into DB until we succeed; note that if the DB

View File

@ -285,7 +285,7 @@ shutdown_action (void *cls)
GNUNET_OS_process_destroy (aggregator_proc); GNUNET_OS_process_destroy (aggregator_proc);
aggregator_proc = NULL; aggregator_proc = NULL;
} }
plugin->drop_temporary (plugin->cls, plugin->drop_tables (plugin->cls,
session); session);
TALER_EXCHANGEDB_plugin_unload (plugin); TALER_EXCHANGEDB_plugin_unload (plugin);
plugin = NULL; plugin = NULL;
@ -1106,8 +1106,7 @@ run (void *cls)
plugin = TALER_EXCHANGEDB_plugin_load (cfg); plugin = TALER_EXCHANGEDB_plugin_load (cfg);
if (GNUNET_OK != if (GNUNET_OK !=
plugin->create_tables (plugin->cls, plugin->create_tables (plugin->cls))
GNUNET_YES))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_EXCHANGEDB_plugin_unload (plugin); TALER_EXCHANGEDB_plugin_unload (plugin);
@ -1115,8 +1114,7 @@ run (void *cls)
result = 77; result = 77;
return; return;
} }
session = plugin->get_session (plugin->cls, session = plugin->get_session (plugin->cls);
GNUNET_YES);
GNUNET_assert (NULL != session); GNUNET_assert (NULL != session);
fake_issue (&issue); fake_issue (&issue);
dpk.rsa_public_key = coin_pub; dpk.rsa_public_key = coin_pub;

View File

@ -1369,7 +1369,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
break; break;
case PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION: case PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION:
state->session = state->plugin->get_session (state->plugin->cls, GNUNET_YES); state->session = state->plugin->get_session (state->plugin->cls);
break; break;
case PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION: case PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION:
@ -1816,8 +1816,7 @@ PERF_TALER_EXCHANGEDB_interpret (struct TALER_EXCHANGEDB_Plugin *db_plugin,
ret = cmd_init (cmd); ret = cmd_init (cmd);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
return ret; return ret;
state.session = db_plugin->get_session (db_plugin->cls, state.session = db_plugin->get_session (db_plugin->cls);
GNUNET_YES);
GNUNET_assert (NULL != state.session); GNUNET_assert (NULL != state.session);
ret = interpret (&state); ret = interpret (&state);
cmd_clean (cmd); cmd_clean (cmd);
@ -1943,8 +1942,7 @@ PERF_TALER_EXCHANGEDB_run_benchmark (const char *benchmark_name,
"Error connectiong to the database\n"); "Error connectiong to the database\n");
return GNUNET_NO; return GNUNET_NO;
} }
ret = plugin->create_tables (plugin->cls, ret = plugin->create_tables (plugin->cls);
GNUNET_YES);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -1981,9 +1979,8 @@ PERF_TALER_EXCHANGEDB_run_benchmark (const char *benchmark_name,
{ {
struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_Session *session;
session = plugin->get_session (plugin->cls, session = plugin->get_session (plugin->cls);
GNUNET_YES); ret = plugin->drop_tables (plugin->cls,
ret = plugin->drop_temporary (plugin->cls,
session); session);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {

View File

@ -29,15 +29,6 @@
#include "plugin_exchangedb_common.c" #include "plugin_exchangedb_common.c"
/**
* For testing / experiments, we set the Postgres schema to
* #TALER_TEMP_SCHEMA_NAME so we can easily purge everything
* associated with a test. We *also* should use the database
* "talercheck" instead of "taler" for testing, but we're doing
* both: better safe than sorry.
*/
#define TALER_TEMP_SCHEMA_NAME "taler_temporary"
/** /**
* Log a query error. * Log a query error.
* *
@ -138,39 +129,48 @@ struct PostgresClosure
/**
* Set the given connection to use a temporary schema
*
* @param db the database connection
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon error
*/
static int
set_temporary_schema (PGconn *db)
{
SQLEXEC_(db,
"CREATE SCHEMA IF NOT EXISTS " TALER_TEMP_SCHEMA_NAME ";"
"SET search_path to " TALER_TEMP_SCHEMA_NAME ";");
return GNUNET_OK;
SQLEXEC_fail:
return GNUNET_SYSERR;
}
/** /**
* Drop the temporary taler schema. This is only useful for testcases * Drop all Taler tables. This should only be used by testcases.
* *
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database session to use * @param session database session to use
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/ */
static int static int
postgres_drop_temporary (void *cls, postgres_drop_tables (void *cls,
struct TALER_EXCHANGEDB_Session *session) struct TALER_EXCHANGEDB_Session *session)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Dropping temporary tables\n"); "Dropping ALL tables\n");
SQLEXEC_ (session->conn, SQLEXEC_ (session->conn,
"DROP SCHEMA " TALER_TEMP_SCHEMA_NAME " CASCADE;"); "DROP TABLE IF EXISTS prewire;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS aggregation_tracking;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS deposits;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS refresh_out;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS refresh_commit_coin;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS refresh_commit_link;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS refresh_order;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS refresh_melts;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS refresh_sessions;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS known_coins;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS reserves_out;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS reserves_in;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS reserves;");
SQLEXEC_ (session->conn,
"DROP TABLE IF EXISTS denominations;");
return GNUNET_OK; return GNUNET_OK;
SQLEXEC_fail: SQLEXEC_fail:
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -215,12 +215,10 @@ pq_notice_processor_cb (void *arg,
* Create the necessary tables if they are not present * Create the necessary tables if they are not present
* *
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state
* @param temporary should we use a temporary schema
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/ */
static int static int
postgres_create_tables (void *cls, postgres_create_tables (void *cls)
int temporary)
{ {
struct PostgresClosure *pc = cls; struct PostgresClosure *pc = cls;
PGconn *conn; PGconn *conn;
@ -239,12 +237,6 @@ postgres_create_tables (void *cls,
PQsetNoticeProcessor (conn, PQsetNoticeProcessor (conn,
&pq_notice_processor_cb, &pq_notice_processor_cb,
NULL); NULL);
if ( (GNUNET_YES == temporary) &&
(GNUNET_SYSERR == set_temporary_schema (conn)))
{
PQfinish (conn);
return GNUNET_SYSERR;
}
#define SQLEXEC(sql) SQLEXEC_(conn, sql); #define SQLEXEC(sql) SQLEXEC_(conn, sql);
#define SQLEXEC_INDEX(sql) SQLEXEC_IGNORE_ERROR_(conn, sql); #define SQLEXEC_INDEX(sql) SQLEXEC_IGNORE_ERROR_(conn, sql);
/* Denomination table for holding the publicly available information of /* Denomination table for holding the publicly available information of
@ -1200,13 +1192,10 @@ db_conn_destroy (void *cls)
* Connect to the db if the connection does not exist yet. * Connect to the db if the connection does not exist yet.
* *
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state
* @param temporary #GNUNET_YES to use a temporary schema; #GNUNET_NO to use the
* database default one
* @return the database connection, or NULL on error * @return the database connection, or NULL on error
*/ */
static struct TALER_EXCHANGEDB_Session * static struct TALER_EXCHANGEDB_Session *
postgres_get_session (void *cls, postgres_get_session (void *cls)
int temporary)
{ {
struct PostgresClosure *pc = cls; struct PostgresClosure *pc = cls;
PGconn *db_conn; PGconn *db_conn;
@ -1229,12 +1218,6 @@ postgres_get_session (void *cls,
PQsetNoticeProcessor (db_conn, PQsetNoticeProcessor (db_conn,
&pq_notice_processor_cb, &pq_notice_processor_cb,
NULL); NULL);
if ( (GNUNET_YES == temporary) &&
(GNUNET_SYSERR == set_temporary_schema(db_conn)) )
{
GNUNET_break (0);
return NULL;
}
if (GNUNET_OK != if (GNUNET_OK !=
postgres_prepare (db_conn)) postgres_prepare (db_conn))
{ {
@ -4243,7 +4226,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin = GNUNET_new (struct TALER_EXCHANGEDB_Plugin); plugin = GNUNET_new (struct TALER_EXCHANGEDB_Plugin);
plugin->cls = pg; plugin->cls = pg;
plugin->get_session = &postgres_get_session; plugin->get_session = &postgres_get_session;
plugin->drop_temporary = &postgres_drop_temporary; plugin->drop_tables = &postgres_drop_tables;
plugin->create_tables = &postgres_create_tables; plugin->create_tables = &postgres_create_tables;
plugin->start = &postgres_start; plugin->start = &postgres_start;
plugin->commit = &postgres_commit; plugin->commit = &postgres_commit;

View File

@ -663,18 +663,27 @@ run (void *cls)
result = 77; result = 77;
return; return;
} }
if (NULL !=
(session = plugin->get_session (plugin->cls)))
{
if (GNUNET_OK != if (GNUNET_OK !=
plugin->create_tables (plugin->cls, plugin->drop_tables (plugin->cls,
GNUNET_YES)) session))
{
result = 77;
goto drop;
}
}
if (GNUNET_OK !=
plugin->create_tables (plugin->cls))
{ {
result = 77; result = 77;
goto drop; goto drop;
} }
if (NULL == if (NULL ==
(session = plugin->get_session (plugin->cls, (session = plugin->get_session (plugin->cls)))
GNUNET_YES)))
{ {
result = 3; result = 77;
goto drop; goto drop;
} }
RND_BLK (&reserve_pub); RND_BLK (&reserve_pub);
@ -934,7 +943,7 @@ run (void *cls)
rh = NULL; rh = NULL;
if (NULL != session) if (NULL != session)
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_OK ==
plugin->drop_temporary (plugin->cls, plugin->drop_tables (plugin->cls,
session)); session));
if (NULL != dkp) if (NULL != dkp)
destroy_denom_key_pair (dkp); destroy_denom_key_pair (dkp);

View File

@ -717,23 +717,20 @@ struct TALER_EXCHANGEDB_Plugin
* Connect to the db if the connection does not exist yet. * Connect to the db if the connection does not exist yet.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param temporary #GNUNET_YES to use a temporary schema; #GNUNET_NO to use the
* database default one
* @param the database connection, or NULL on error * @param the database connection, or NULL on error
*/ */
struct TALER_EXCHANGEDB_Session * struct TALER_EXCHANGEDB_Session *
(*get_session) (void *cls, (*get_session) (void *cls);
int temporary);
/** /**
* Drop the temporary taler schema. This is only useful for testcases. * Drop the Taler tables. This should only be used in testcases.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/ */
int int
(*drop_temporary) (void *cls, (*drop_tables) (void *cls,
struct TALER_EXCHANGEDB_Session *db); struct TALER_EXCHANGEDB_Session *db);
@ -741,12 +738,10 @@ struct TALER_EXCHANGEDB_Plugin
* Create the necessary tables if they are not present * Create the necessary tables if they are not present
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param temporary should we use a temporary schema
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/ */
int int
(*create_tables) (void *cls, (*create_tables) (void *cls);
int temporary);
/** /**