re-init logging so we can tell by PID who it is

This commit is contained in:
Christian Grothoff 2018-08-19 17:19:27 +02:00
parent 0df2028f96
commit 190a1fadaf
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
10 changed files with 56 additions and 18 deletions

View File

@ -2120,6 +2120,7 @@ wire_transfer_information_cb (void *cls,
qs = edb->get_coin_transactions (edb->cls, qs = edb->get_coin_transactions (edb->cls,
esession, esession,
coin_pub, coin_pub,
GNUNET_YES,
&tl); &tl);
if ( (qs < 0) || if ( (qs < 0) ||
(NULL == tl) ) (NULL == tl) )

View File

@ -571,6 +571,9 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
fakebank = fork (); fakebank = fork ();
if (0 == fakebank) if (0 == fakebank)
{ {
GNUNET_log_setup ("benchmark-fakebank",
NULL == loglev ? "INFO" : loglev,
logfile);
GNUNET_SCHEDULER_run (&launch_fakebank, GNUNET_SCHEDULER_run (&launch_fakebank,
exchange_bank_account.bank_base_url); exchange_bank_account.bank_base_url);
exit (0); exit (0);
@ -686,6 +689,9 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
if (0 == (cpids[i] = fork ())) if (0 == (cpids[i] = fork ()))
{ {
/* I am the child, do the work! */ /* I am the child, do the work! */
GNUNET_log_setup ("benchmark-worker",
NULL == loglev ? "INFO" : loglev,
logfile);
result = TALER_TESTING_setup result = TALER_TESTING_setup
(run, (run,
NULL, NULL,

View File

@ -153,7 +153,7 @@ deposit_transaction (void *cls,
} }
return qs; return qs;
} }
if (1 == qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{ {
struct TALER_Amount amount_without_fee; struct TALER_Amount amount_without_fee;
@ -182,6 +182,7 @@ deposit_transaction (void *cls,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session, session,
&deposit->coin.coin_pub, &deposit->coin.coin_pub,
GNUNET_NO,
&tl); &tl);
if (0 > qs) if (0 > qs)
return qs; return qs;

View File

@ -209,6 +209,7 @@ payback_transaction (void *cls,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session, session,
&pc->coin->coin_pub, &pc->coin->coin_pub,
GNUNET_YES,
&tl); &tl);
if (0 > qs) if (0 > qs)
{ {

View File

@ -172,6 +172,7 @@ refresh_check_melt (struct MHD_Connection *connection,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session, session,
&rmc->refresh_session.coin.coin_pub, &rmc->refresh_session.coin.coin_pub,
GNUNET_NO,
&tl); &tl);
if (0 > qs) if (0 > qs)
{ {

View File

@ -164,6 +164,7 @@ refund_transaction (void *cls,
qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls,
session, session,
&refund->coin.coin_pub, &refund->coin.coin_pub,
GNUNET_NO,
&tl); &tl);
if (0 > qs) if (0 > qs)
{ {

View File

@ -1410,6 +1410,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
qs = state->plugin->get_coin_transactions (state->plugin->cls, qs = state->plugin->get_coin_transactions (state->plugin->cls,
state->session, state->session,
&coin->public_info.coin_pub, &coin->public_info.coin_pub,
GNUNET_YES,
&transactions); &transactions);
GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs); GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
GNUNET_assert (transactions != NULL); GNUNET_assert (transactions != NULL);

View File

@ -1579,7 +1579,7 @@ postgres_prepare (PGconn *db_conn)
",denoms.denom_pub" ",denoms.denom_pub"
",coins.denom_sig" ",coins.denom_sig"
" FROM payback" " FROM payback"
" JOIN known_coins coins" " JOIN kown_coins coins"
" USING (coin_pub)" " USING (coin_pub)"
" JOIN denominations denoms" " JOIN denominations denoms"
" USING (denom_pub_hash)" " USING (denom_pub_hash)"
@ -4276,6 +4276,23 @@ add_coin_payback (void *cls,
} }
/**
* Work we need to do.
*/
struct Work
{
/**
* SQL prepared statement name.
*/
const char *statement;
/**
* Function to call to handle the result(s).
*/
GNUNET_PQ_PostgresResultHandler cb;
};
/** /**
* Compile a list of all (historic) transactions performed * Compile a list of all (historic) transactions performed
* with the given coin (/refresh/melt, /deposit and /refund operations). * with the given coin (/refresh/melt, /deposit and /refund operations).
@ -4290,25 +4307,22 @@ static enum GNUNET_DB_QueryStatus
postgres_get_coin_transactions (void *cls, postgres_get_coin_transactions (void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
int include_payback,
struct TALER_EXCHANGEDB_TransactionList **tlp) struct TALER_EXCHANGEDB_TransactionList **tlp)
{ {
struct CoinHistoryContext chc; static const struct Work work_op[] = {
struct GNUNET_PQ_QueryParam params[] = { /** #TALER_EXCHANGEDB_TT_DEPOSIT */
GNUNET_PQ_query_param_auto_from_type (coin_pub), { "get_deposit_with_coin_pub",
GNUNET_PQ_query_param_end &add_coin_deposit },
/** #TALER_EXCHANGEDB_TT_REFRESH_MELT */
{ "get_refresh_session_by_coin",
&add_coin_melt },
/** #TALER_EXCHANGEDB_TT_REFUND */
{ "get_refunds_by_coin",
&add_coin_refund },
{ NULL, NULL }
}; };
enum GNUNET_DB_QueryStatus qs; static const struct Work work_wp[] = {
struct {
/**
* SQL prepared statement name.
*/
const char *statement;
/**
* Function to call to handle the result(s).
*/
GNUNET_PQ_PostgresResultHandler cb;
} work[] = {
/** #TALER_EXCHANGEDB_TT_DEPOSIT */ /** #TALER_EXCHANGEDB_TT_DEPOSIT */
{ "get_deposit_with_coin_pub", { "get_deposit_with_coin_pub",
&add_coin_deposit }, &add_coin_deposit },
@ -4323,7 +4337,15 @@ postgres_get_coin_transactions (void *cls,
&add_coin_payback }, &add_coin_payback },
{ NULL, NULL } { NULL, NULL }
}; };
struct CoinHistoryContext chc;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
const struct Work * work;
work = (GNUNET_YES == include_payback) ? work_wp : work_op;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Getting transactions for coin %s\n", "Getting transactions for coin %s\n",
TALER_B2S (coin_pub)); TALER_B2S (coin_pub));

View File

@ -718,6 +718,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
qs = plugin->get_coin_transactions (plugin->cls, qs = plugin->get_coin_transactions (plugin->cls,
session, session,
&refresh_session.coin.coin_pub, &refresh_session.coin.coin_pub,
GNUNET_YES,
&tl); &tl);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs); FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs);
plugin->free_coin_transaction_list (plugin->cls, plugin->free_coin_transaction_list (plugin->cls,
@ -2132,6 +2133,7 @@ run (void *cls)
qs = plugin->get_coin_transactions (plugin->cls, qs = plugin->get_coin_transactions (plugin->cls,
session, session,
&refund.coin.coin_pub, &refund.coin.coin_pub,
GNUNET_YES,
&tl); &tl);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs); FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs);
GNUNET_assert (NULL != tl); GNUNET_assert (NULL != tl);

View File

@ -1680,6 +1680,7 @@ struct TALER_EXCHANGEDB_Plugin
* @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 session database connection * @param session database connection
* @param coin_pub coin to investigate * @param coin_pub coin to investigate
* @param include_payback include payback transactions of the coin?
* @param[out] tlp set to list of transactions, NULL if coin is fresh * @param[out] tlp set to list of transactions, NULL if coin is fresh
* @return database transaction status * @return database transaction status
*/ */
@ -1687,6 +1688,7 @@ struct TALER_EXCHANGEDB_Plugin
(*get_coin_transactions) (void *cls, (*get_coin_transactions) (void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
int include_payback,
struct TALER_EXCHANGEDB_TransactionList **tlp); struct TALER_EXCHANGEDB_TransactionList **tlp);