Skip to content

Commit

Permalink
Merge pull request #2103 from vogel/do-not-allow-gaps-in-history
Browse files Browse the repository at this point in the history
Do not allow gaps in history

Reviewed-by: MonsieurNicolas
  • Loading branch information
latobarita authored Jun 15, 2019
2 parents f2cc347 + e584b43 commit 46fdead
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 306 deletions.
9 changes: 6 additions & 3 deletions docs/software/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ Common options can be placed at any place in the command line.
Command options can only by placed after command.

* **catchup <DESTINATION-LEDGER/LEDGER-COUNT>**: Perform catchup from history
archives without connecting to network. This option will catchup to
DESTINATION-LEDGER keeping history from DESTINATION-LEDGER-LEDGER-COUNT or
from the last closed ledger (whichever value is biggest).
archives without connecting to network. For new instances (with empty history
tables - only ledger 1 present in the database) it will respect LEDGER-COUNT
configuration and it will perform bucket application on such a checkpoint
that at least LEDGER-COUNT entries are present in history table afterwards.
For instances that already have some history entries, all ledgers since last
closed ledger will be replayed.
* **check-quorum**: Check quorum intersection from history to ensure there is
closure over all the validators in the network.
* **convert-id <ID>**: Will output the passed ID in all known forms and then
Expand Down
2 changes: 2 additions & 0 deletions src/catchup/ApplyBucketsWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ ApplyBucketsWork::getBucket(std::string const& hash)
void
ApplyBucketsWork::onReset()
{
CLOG(INFO, "History") << "Applying buckets";

mTotalBuckets = 0;
mAppliedBuckets = 0;
mAppliedEntries = 0;
Expand Down
19 changes: 9 additions & 10 deletions src/catchup/ApplyLedgerChainWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,24 @@ ApplyLedgerChainWork::getStatus() const
if (getState() == State::WORK_RUNNING)
{
std::string task = "applying checkpoint";
return fmtProgress(mApp, task, mRange.first(), mRange.last(), mCurrSeq);
return fmtProgress(mApp, task, mRange.mFirst, mRange.mLast, mCurrSeq);
}
return BasicWork::getStatus();
}

void
ApplyLedgerChainWork::onReset()
{
mLastApplied = mApp.getLedgerManager().getLastClosedLedgerHeader();
auto& lm = mApp.getLedgerManager();
auto& hm = mApp.getHistoryManager();

CLOG(INFO, "History") << "Replaying contents of "
<< CheckpointRange{mRange, hm}.count()
<< " transaction-history files from LCL "
<< LedgerManager::ledgerAbbrev(
lm.getLastClosedLedgerHeader());
mCurrSeq =
mApp.getHistoryManager().checkpointContainingLedger(mRange.first());
CLOG(INFO, "History") << fmt::format(
"Applying transactions for ledgers {}, LCL is {}", mRange.toString(),
LedgerManager::ledgerAbbrev(lm.getLastClosedLedgerHeader()));

mLastApplied = lm.getLastClosedLedgerHeader();

mCurrSeq = hm.checkpointContainingLedger(mRange.mFirst);
mHdrIn.close();
mTxIn.close();
mFilesOpen = false;
Expand Down Expand Up @@ -253,7 +252,7 @@ ApplyLedgerChainWork::onRun()

auto& lm = mApp.getLedgerManager();
auto const& lclHeader = lm.getLastClosedLedgerHeader();
if (lclHeader.header.ledgerSeq == mRange.last())
if (lclHeader.header.ledgerSeq == mRange.mLast)
{
return State::WORK_SUCCESS;
}
Expand Down
Loading

0 comments on commit 46fdead

Please sign in to comment.