mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-03 17:05:50 +00:00
Report fetch pack errors with shards
This commit is contained in:
committed by
Nik Bougalis
parent
b36e9dd1b4
commit
820546c873
@@ -256,7 +256,7 @@ private:
|
|||||||
std::shared_ptr<Ledger const> ledger);
|
std::shared_ptr<Ledger const> ledger);
|
||||||
|
|
||||||
void getFetchPack(
|
void getFetchPack(
|
||||||
LedgerIndex missingIndex, InboundLedger::Reason reason);
|
LedgerIndex missing, InboundLedger::Reason reason);
|
||||||
|
|
||||||
boost::optional<LedgerHash> getLedgerHashForHistory(
|
boost::optional<LedgerHash> getLedgerHashForHistory(
|
||||||
LedgerIndex index, InboundLedger::Reason reason);
|
LedgerIndex index, InboundLedger::Reason reason);
|
||||||
|
|||||||
@@ -516,16 +516,29 @@ LedgerMaster::tryFill (
|
|||||||
/** Request a fetch pack to get to the specified ledger
|
/** Request a fetch pack to get to the specified ledger
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
LedgerMaster::getFetchPack (LedgerIndex missingIndex,
|
LedgerMaster::getFetchPack (LedgerIndex missing,
|
||||||
InboundLedger::Reason reason)
|
InboundLedger::Reason reason)
|
||||||
{
|
{
|
||||||
auto haveHash = getLedgerHashForHistory(
|
auto haveHash {getLedgerHashForHistory(missing + 1, reason)};
|
||||||
missingIndex + 1, reason);
|
|
||||||
if (!haveHash || haveHash->isZero())
|
if (!haveHash || haveHash->isZero())
|
||||||
{
|
{
|
||||||
JLOG (m_journal.error()) <<
|
if (reason == InboundLedger::Reason::SHARD)
|
||||||
"No hash for fetch pack. Missing Index " <<
|
{
|
||||||
std::to_string(missingIndex);
|
auto const shardStore {app_.getShardStore()};
|
||||||
|
auto const shardIndex {shardStore->seqToShardIndex(missing)};
|
||||||
|
if (missing < shardStore->lastLedgerSeq(shardIndex))
|
||||||
|
{
|
||||||
|
JLOG(m_journal.error())
|
||||||
|
<< "No hash for fetch pack. "
|
||||||
|
<< "Missing ledger sequence " << missing
|
||||||
|
<< " while acquiring shard " << shardIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JLOG(m_journal.error()) <<
|
||||||
|
"No hash for fetch pack. Missing Index " << missing;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +550,7 @@ LedgerMaster::getFetchPack (LedgerIndex missingIndex,
|
|||||||
auto peerList = app_.overlay ().getActivePeers();
|
auto peerList = app_.overlay ().getActivePeers();
|
||||||
for (auto const& peer : peerList)
|
for (auto const& peer : peerList)
|
||||||
{
|
{
|
||||||
if (peer->hasRange (missingIndex, missingIndex + 1))
|
if (peer->hasRange (missing, missing + 1))
|
||||||
{
|
{
|
||||||
int score = peer->getScore (true);
|
int score = peer->getScore (true);
|
||||||
if (! target || (score > maxScore))
|
if (! target || (score > maxScore))
|
||||||
@@ -559,8 +572,7 @@ LedgerMaster::getFetchPack (LedgerIndex missingIndex,
|
|||||||
tmBH, protocol::mtGET_OBJECTS);
|
tmBH, protocol::mtGET_OBJECTS);
|
||||||
|
|
||||||
target->send (packet);
|
target->send (packet);
|
||||||
JLOG (m_journal.trace()) << "Requested fetch pack for "
|
JLOG(m_journal.trace()) << "Requested fetch pack for " << missing;
|
||||||
<< missingIndex;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
JLOG (m_journal.debug()) << "No peer for fetch pack";
|
JLOG (m_journal.debug()) << "No peer for fetch pack";
|
||||||
|
|||||||
Reference in New Issue
Block a user