-experimental wirewatch change to keep shard locks across history requests
This commit is contained in:
parent
9e0df07a16
commit
a6494f9905
@ -480,6 +480,16 @@ mark_shard_done (struct WireAccount *wa)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue with the credit history of the shard
|
||||||
|
* reserved as @a wa_pos.
|
||||||
|
*
|
||||||
|
* @param[in,out] wa_pos shard to continue processing
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
continue_with_shard (struct WireAccount *wa_pos);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We are finished with the current transaction, try
|
* We are finished with the current transaction, try
|
||||||
* to commit and then schedule the next iteration.
|
* to commit and then schedule the next iteration.
|
||||||
@ -490,9 +500,10 @@ static void
|
|||||||
do_commit (struct WireAccount *wa)
|
do_commit (struct WireAccount *wa)
|
||||||
{
|
{
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
bool shard_done;
|
||||||
|
|
||||||
wa->started_transaction = false;
|
wa->started_transaction = false;
|
||||||
mark_shard_done (wa);
|
shard_done = mark_shard_done (wa);
|
||||||
qs = db_plugin->commit (db_plugin->cls);
|
qs = db_plugin->commit (db_plugin->cls);
|
||||||
switch (qs)
|
switch (qs)
|
||||||
{
|
{
|
||||||
@ -509,7 +520,10 @@ do_commit (struct WireAccount *wa)
|
|||||||
/* normal case */
|
/* normal case */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
shard_completed (wa);
|
if (shard_done)
|
||||||
|
shard_completed (wa);
|
||||||
|
else
|
||||||
|
continue_with_shard (wa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -681,7 +695,6 @@ static void
|
|||||||
find_transfers (void *cls)
|
find_transfers (void *cls)
|
||||||
{
|
{
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
unsigned int limit;
|
|
||||||
|
|
||||||
(void) cls;
|
(void) cls;
|
||||||
task = NULL;
|
task = NULL;
|
||||||
@ -761,15 +774,23 @@ find_transfers (void *cls)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wa_pos->latest_row_off = wa_pos->batch_start;
|
||||||
|
continue_with_shard (wa_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
continue_with_shard (struct WireAccount *wa_pos)
|
||||||
|
{
|
||||||
|
unsigned int limit;
|
||||||
|
|
||||||
limit = GNUNET_MIN (wa_pos->batch_size,
|
limit = GNUNET_MIN (wa_pos->batch_size,
|
||||||
wa_pos->shard_end - wa_pos->batch_start);
|
wa_pos->shard_end - wa_pos->latest_row_off);
|
||||||
GNUNET_assert (NULL == wa_pos->hh);
|
GNUNET_assert (NULL == wa_pos->hh);
|
||||||
wa_pos->latest_row_off = wa_pos->batch_start;
|
wa_pos->max_row_off = wa_pos->latest_row_off + limit - 1;
|
||||||
wa_pos->max_row_off = wa_pos->batch_start + limit - 1;
|
|
||||||
wa_pos->hh = TALER_BANK_credit_history (ctx,
|
wa_pos->hh = TALER_BANK_credit_history (ctx,
|
||||||
wa_pos->ai->auth,
|
wa_pos->ai->auth,
|
||||||
wa_pos->batch_start,
|
wa_pos->latest_row_off,
|
||||||
limit,
|
limit,
|
||||||
test_mode
|
test_mode
|
||||||
? GNUNET_TIME_UNIT_ZERO
|
? GNUNET_TIME_UNIT_ZERO
|
||||||
|
Loading…
Reference in New Issue
Block a user