use precise time for shards
This commit is contained in:
parent
8e71a7e4de
commit
d77354b11a
@ -417,7 +417,7 @@ schedule_transfers (struct WireAccount *wa)
|
|||||||
wa = wa_head;
|
wa = wa_head;
|
||||||
GNUNET_assert (NULL != wa);
|
GNUNET_assert (NULL != wa);
|
||||||
}
|
}
|
||||||
if (shard_done)
|
if (wa->shard_open)
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Will retry my shard (%llu,%llu] of %s in %s\n",
|
"Will retry my shard (%llu,%llu] of %s in %s\n",
|
||||||
(unsigned long long) wa->shard_start,
|
(unsigned long long) wa->shard_start,
|
||||||
@ -527,14 +527,14 @@ check_shard_done (struct WireAccount *wa)
|
|||||||
break;
|
break;
|
||||||
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
|
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
|
||||||
/* normal case */
|
/* normal case */
|
||||||
wa->shard_delay = GNUNET_TIME_absolute_get_duration (wa->shard_start_time);
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Completed shard %s (%llu,%llu] after %s\n",
|
"Completed shard %s (%llu,%llu] after %s\n",
|
||||||
wa->job_name,
|
wa->job_name,
|
||||||
(unsigned long long) wa->shard_start,
|
(unsigned long long) wa->shard_start,
|
||||||
(unsigned long long) wa->shard_end,
|
(unsigned long long) wa->shard_end,
|
||||||
GNUNET_STRINGS_relative_time_to_string (wa->shard_delay,
|
GNUNET_STRINGS_relative_time_to_string (
|
||||||
GNUNET_YES));
|
GNUNET_TIME_absolute_get_duration (wa->shard_start_time),
|
||||||
|
GNUNET_YES));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -583,6 +583,7 @@ do_commit (struct WireAccount *wa)
|
|||||||
}
|
}
|
||||||
if (shard_done)
|
if (shard_done)
|
||||||
{
|
{
|
||||||
|
wa->shard_delay = GNUNET_TIME_absolute_get_duration (wa->shard_start_time);
|
||||||
wa->shard_open = false;
|
wa->shard_open = false;
|
||||||
account_completed (wa);
|
account_completed (wa);
|
||||||
}
|
}
|
||||||
@ -829,6 +830,9 @@ lock_shard (void *cls)
|
|||||||
wa);
|
wa);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (wa->shard_open)
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
|
"Shard not completed in time, will try to re-acquire\n");
|
||||||
/* How long we lock a shard depends on the number of
|
/* How long we lock a shard depends on the number of
|
||||||
workers expected, and how long we usually took to
|
workers expected, and how long we usually took to
|
||||||
process a shard. */
|
process a shard. */
|
||||||
|
@ -12946,17 +12946,16 @@ postgres_begin_shard (void *cls,
|
|||||||
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
|
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
|
||||||
{
|
{
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
struct GNUNET_TIME_Timestamp now;
|
struct GNUNET_TIME_Absolute now;
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_string (job_name),
|
GNUNET_PQ_query_param_string (job_name),
|
||||||
GNUNET_PQ_query_param_timestamp (&now),
|
GNUNET_PQ_query_param_absolute_time (&now),
|
||||||
GNUNET_PQ_query_param_uint64 (start_row),
|
GNUNET_PQ_query_param_uint64 (start_row),
|
||||||
GNUNET_PQ_query_param_uint64 (end_row),
|
GNUNET_PQ_query_param_uint64 (end_row),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
now = GNUNET_TIME_absolute_to_timestamp (
|
now = GNUNET_TIME_relative_to_absolute (delay);
|
||||||
GNUNET_TIME_relative_to_absolute (delay));
|
|
||||||
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||||
"reclaim_shard",
|
"reclaim_shard",
|
||||||
params);
|
params);
|
||||||
@ -13021,17 +13020,16 @@ postgres_begin_shard (void *cls,
|
|||||||
/* Claim fresh shard */
|
/* Claim fresh shard */
|
||||||
{
|
{
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
struct GNUNET_TIME_Timestamp now;
|
struct GNUNET_TIME_Absolute now;
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_string (job_name),
|
GNUNET_PQ_query_param_string (job_name),
|
||||||
GNUNET_PQ_query_param_timestamp (&now),
|
GNUNET_PQ_query_param_absolute_time (&now),
|
||||||
GNUNET_PQ_query_param_uint64 (start_row),
|
GNUNET_PQ_query_param_uint64 (start_row),
|
||||||
GNUNET_PQ_query_param_uint64 (end_row),
|
GNUNET_PQ_query_param_uint64 (end_row),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
now = GNUNET_TIME_absolute_to_timestamp (
|
now = GNUNET_TIME_relative_to_absolute (delay);
|
||||||
GNUNET_TIME_relative_to_absolute (delay));
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Trying to claim shard (%llu-%llu]\n",
|
"Trying to claim shard (%llu-%llu]\n",
|
||||||
(unsigned long long) *start_row,
|
(unsigned long long) *start_row,
|
||||||
@ -13222,10 +13220,10 @@ postgres_begin_revolving_shard (void *cls,
|
|||||||
{
|
{
|
||||||
/* Claim fresh shard */
|
/* Claim fresh shard */
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
struct GNUNET_TIME_Timestamp now;
|
struct GNUNET_TIME_Absolute now;
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_string (job_name),
|
GNUNET_PQ_query_param_string (job_name),
|
||||||
GNUNET_PQ_query_param_timestamp (&now),
|
GNUNET_PQ_query_param_absolute_time (&now),
|
||||||
GNUNET_PQ_query_param_uint32 (start_row),
|
GNUNET_PQ_query_param_uint32 (start_row),
|
||||||
GNUNET_PQ_query_param_uint32 (end_row),
|
GNUNET_PQ_query_param_uint32 (end_row),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
@ -13233,7 +13231,7 @@ postgres_begin_revolving_shard (void *cls,
|
|||||||
|
|
||||||
*end_row = GNUNET_MIN (shard_limit,
|
*end_row = GNUNET_MIN (shard_limit,
|
||||||
*start_row + shard_size - 1);
|
*start_row + shard_size - 1);
|
||||||
now = GNUNET_TIME_timestamp_get ();
|
now = GNUNET_TIME_absolute_get ();
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Trying to claim shard %llu-%llu\n",
|
"Trying to claim shard %llu-%llu\n",
|
||||||
(unsigned long long) *start_row,
|
(unsigned long long) *start_row,
|
||||||
|
Loading…
Reference in New Issue
Block a user