From 4d00c34829c429e8942a4192b64c7ffb83b47bf0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 6 Jan 2023 13:12:18 +0100 Subject: [PATCH] -log origin of serialization errors --- contrib/gana | 2 +- src/exchangedb/pg_begin_shard.c | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/contrib/gana b/contrib/gana index 3e659ed54..df1d19891 160000 --- a/contrib/gana +++ b/contrib/gana @@ -1 +1 @@ -Subproject commit 3e659ed54023230dd45dbec5664f176e1763d260 +Subproject commit df1d198918cbdd03c18723d818979c8d09f8f231 diff --git a/src/exchangedb/pg_begin_shard.c b/src/exchangedb/pg_begin_shard.c index 2d4a33af8..8e829f3e9 100644 --- a/src/exchangedb/pg_begin_shard.c +++ b/src/exchangedb/pg_begin_shard.c @@ -28,13 +28,14 @@ #include "pg_rollback.h" #include "pg_commit.h" + enum GNUNET_DB_QueryStatus TEH_PG_begin_shard (void *cls, - const char *job_name, - struct GNUNET_TIME_Relative delay, - uint64_t shard_size, - uint64_t *start_row, - uint64_t *end_row) + const char *job_name, + struct GNUNET_TIME_Relative delay, + uint64_t shard_size, + uint64_t *start_row, + uint64_t *end_row) { struct PostgresClosure *pg = cls; @@ -42,7 +43,7 @@ TEH_PG_begin_shard (void *cls, { if (GNUNET_OK != TEH_PG_start (pg, - "begin_shard")) + "begin_shard")) { GNUNET_break (0); return GNUNET_DB_STATUS_HARD_ERROR; @@ -65,7 +66,6 @@ TEH_PG_begin_shard (void *cls, }; past = GNUNET_TIME_absolute_get (); - PREPARE (pg, "get_open_shard", "SELECT" @@ -77,7 +77,6 @@ TEH_PG_begin_shard (void *cls, " AND last_attempt<$2" " ORDER BY last_attempt ASC" " LIMIT 1;"); - qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "get_open_shard", params, @@ -89,6 +88,8 @@ TEH_PG_begin_shard (void *cls, TEH_PG_rollback (pg); return qs; case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Serialization error on getting open shard\n"); TEH_PG_rollback (pg); continue; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -104,8 +105,6 @@ TEH_PG_begin_shard (void *cls, }; now = GNUNET_TIME_relative_to_absolute (delay); - - PREPARE (pg, "reclaim_shard", "UPDATE work_shards" @@ -113,7 +112,6 @@ TEH_PG_begin_shard (void *cls, " WHERE job_name=$1" " AND start_row=$3" " AND end_row=$4"); - qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "reclaim_shard", params); @@ -124,6 +122,8 @@ TEH_PG_begin_shard (void *cls, TEH_PG_rollback (pg); return qs; case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Serialization error on claiming open shard\n"); TEH_PG_rollback (pg); continue; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -172,6 +172,8 @@ TEH_PG_begin_shard (void *cls, TEH_PG_rollback (pg); return qs; case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Serialization error on getting last shard\n"); TEH_PG_rollback (pg); continue; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -220,6 +222,8 @@ TEH_PG_begin_shard (void *cls, TEH_PG_rollback (pg); return qs; case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Serialization error on claiming next shard\n"); TEH_PG_rollback (pg); continue; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -246,6 +250,8 @@ commit: TEH_PG_rollback (pg); return qs; case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Serialization error on commit for beginning shard\n"); TEH_PG_rollback (pg); continue; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: