Requeue pull with last received expected block
* Requeue pull with last received expected block If bulk pull client fails in the middle of large pull * Fixing else without a previous if * Requesting pull from frontier peer after 4 attempts * Print remaining sync queue in logs to make sync speed estimations
This commit is contained in:
parent
8fd47b20dc
commit
e939dd2704
2 changed files with 24 additions and 8 deletions
|
@ -453,9 +453,14 @@ rai::bulk_pull_client::~bulk_pull_client ()
|
|||
--connection->attempt->pulling;
|
||||
connection->attempt->condition.notify_all ();
|
||||
}
|
||||
if (!pull.account.is_zero ())
|
||||
// If received end block is not expected end block
|
||||
if (expected != pull.end)
|
||||
{
|
||||
connection->attempt->requeue_pull (pull);
|
||||
connection->attempt->requeue_pull (rai::pull_info (pull.account, expected, pull.end));
|
||||
if (connection->node->config.logging.bulk_pull_logging ())
|
||||
{
|
||||
BOOST_LOG (connection->node->log) << boost::str (boost::format ("Bulk pull end block is not expected %1% for account %2%") % pull.end.to_string () % pull.account.to_account ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,11 +478,11 @@ void rai::bulk_pull_client::request (rai::pull_info const & pull_a)
|
|||
}
|
||||
if (connection->node->config.logging.bulk_pull_logging ())
|
||||
{
|
||||
BOOST_LOG (connection->node->log) << boost::str (boost::format ("Requesting account %1% from %2%") % req.start.to_account () % connection->endpoint);
|
||||
BOOST_LOG (connection->node->log) << boost::str (boost::format ("Requesting account %1% from %2%. %3% accounts in queue") % req.start.to_account () % connection->endpoint % connection->attempt->pulls.size ());
|
||||
}
|
||||
else if (connection->node->config.logging.network_logging () && connection->attempt->account_count++ % 256 == 0)
|
||||
{
|
||||
BOOST_LOG (connection->node->log) << boost::str (boost::format ("Requesting account %1% from %2%") % req.start.to_account () % connection->endpoint);
|
||||
BOOST_LOG (connection->node->log) << boost::str (boost::format ("Requesting account %1% from %2%. %3% accounts in queue") % req.start.to_account () % connection->endpoint % connection->attempt->pulls.size ());
|
||||
}
|
||||
auto this_l (shared_from_this ());
|
||||
connection->start_timeout ();
|
||||
|
@ -556,10 +561,6 @@ void rai::bulk_pull_client::received_type ()
|
|||
case rai::block_type::not_a_block:
|
||||
{
|
||||
connection->attempt->pool_connection (connection);
|
||||
if (expected == pull.end)
|
||||
{
|
||||
pull = rai::pull_info ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -781,6 +782,7 @@ bool rai::bootstrap_attempt::request_frontier (std::unique_lock<std::mutex> & lo
|
|||
{
|
||||
auto result (true);
|
||||
auto connection_l (connection (lock_a));
|
||||
connection_frontier_request = connection_l;
|
||||
if (connection_l)
|
||||
{
|
||||
std::future<bool> future;
|
||||
|
@ -1024,6 +1026,19 @@ void rai::bootstrap_attempt::requeue_pull (rai::pull_info const & pull_a)
|
|||
pulls.push_front (pull);
|
||||
condition.notify_all ();
|
||||
}
|
||||
else if (pull.attempts == 4 && !connection_frontier_request.expired ())
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (mutex);
|
||||
auto connection_shared = connection_frontier_request.lock ();
|
||||
auto client (std::make_shared<rai::bulk_pull_client> (connection_shared));
|
||||
node->background ([client, pull]() {
|
||||
client->request (pull);
|
||||
});
|
||||
if (node->config.logging.bulk_pull_logging ())
|
||||
{
|
||||
BOOST_LOG (node->log) << boost::str (boost::format ("Requesting pull account %1% from frontier peer after %2% attempts") % pull.account.to_account () % pull.attempts);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node->config.logging.bulk_pull_logging ())
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
void requeue_pull (rai::pull_info const &);
|
||||
bool still_pulling ();
|
||||
std::deque<std::weak_ptr<rai::bootstrap_client>> clients;
|
||||
std::weak_ptr<rai::bootstrap_client> connection_frontier_request;
|
||||
std::weak_ptr<rai::frontier_req_client> frontiers;
|
||||
std::weak_ptr<rai::bulk_push_client> push;
|
||||
std::deque<rai::pull_info> pulls;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue