Ledger acquire timing changes. Better logging of acquire stalls.

This commit is contained in:
JoelKatz
2013-02-21 02:47:19 -08:00
parent a2a52ad88b
commit 1e2aba6b38
2 changed files with 11 additions and 3 deletions

View File

@@ -483,7 +483,7 @@ int Config::getSize(SizedItemName item)
{ {
SizedItem sizeTable[] = { SizedItem sizeTable[] = {
{ siSweepInterval, { 10, 30, 60, 90, 90 } }, { siSweepInterval, { 10, 30, 60, 90, 90 } },
{ siLedgerFetch, { 2, 4, 5, 6, 6 } }, { siLedgerFetch, { 2, 2, 3, 4, 5 } },
{ siValidationsSize, { 256, 256, 512, 1024, 1024 } }, { siValidationsSize, { 256, 256, 512, 1024, 1024 } },
{ siValidationsAge, { 500, 500, 500, 500, 500 } }, { siValidationsAge, { 500, 500, 500, 500, 500 } },
{ siNodeCacheSize, { 8192, 32768, 131072, 1048576, 0 } }, { siNodeCacheSize, { 8192, 32768, 131072, 1048576, 0 } },

View File

@@ -180,7 +180,10 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l
} }
if (theApp->getMasterLedgerAcquire().isFailure(ledgerHash)) if (theApp->getMasterLedgerAcquire().isFailure(ledgerHash))
{
cLog(lsTRACE) << "Already failed to acquire " << ledgerSeq;
return false; return false;
}
mMissingLedger = theApp->getMasterLedgerAcquire().findCreate(ledgerHash); mMissingLedger = theApp->getMasterLedgerAcquire().findCreate(ledgerHash);
if (mMissingLedger->isComplete()) if (mMissingLedger->isComplete())
@@ -209,7 +212,7 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l
if (fetchCount < fetchMax) if (fetchCount < fetchMax)
{ {
if (timeoutCount > 4) if (timeoutCount > 2)
{ {
cLog(lsDEBUG) << "Not acquiring due to timeouts"; cLog(lsDEBUG) << "Not acquiring due to timeouts";
} }
@@ -257,7 +260,7 @@ bool LedgerMaster::shouldAcquire(uint32 currentLedger, uint32 ledgerHistory, uin
if (candidateLedger >= currentLedger) if (candidateLedger >= currentLedger)
ret = true; ret = true;
else ret = (currentLedger - candidateLedger) <= ledgerHistory; else ret = (currentLedger - candidateLedger) <= ledgerHistory;
cLog(lsTRACE) << "Missing ledger " << candidateLedger << (ret ? " will" : " will NOT") << " be acquired"; cLog(lsTRACE) << "Missing ledger " << candidateLedger << (ret ? " should" : " should NOT") << " be acquired";
return ret; return ret;
} }
@@ -370,7 +373,10 @@ void LedgerMaster::setFullLedger(Ledger::ref ledger)
if (!mCompleteLedgers.hasValue(ledger->getLedgerSeq() - 1)) if (!mCompleteLedgers.hasValue(ledger->getLedgerSeq() - 1))
{ {
if (!shouldAcquire(mCurrentLedger->getLedgerSeq(), theConfig.LEDGER_HISTORY, ledger->getLedgerSeq() - 1)) if (!shouldAcquire(mCurrentLedger->getLedgerSeq(), theConfig.LEDGER_HISTORY, ledger->getLedgerSeq() - 1))
{
cLog(lsTRACE) << "Don't need any ledgers";
return; return;
}
cLog(lsDEBUG) << "We need the ledger before the ledger we just accepted: " << ledger->getLedgerSeq() - 1; cLog(lsDEBUG) << "We need the ledger before the ledger we just accepted: " << ledger->getLedgerSeq() - 1;
acquireMissingLedger(ledger, ledger->getParentHash(), ledger->getLedgerSeq() - 1); acquireMissingLedger(ledger, ledger->getParentHash(), ledger->getLedgerSeq() - 1);
} }
@@ -395,6 +401,8 @@ void LedgerMaster::setFullLedger(Ledger::ref ledger)
cLog(lsWARNING) << "We have a gap we can't fix: " << prevMissing + 1; cLog(lsWARNING) << "We have a gap we can't fix: " << prevMissing + 1;
} }
} }
else
cLog(lsTRACE) << "Shouldn't acquire";
} }
} }