Skip to content

Commit

Permalink
Bugfix: make partial checkpoint files during DB migration, fix bug in…
Browse files Browse the repository at this point in the history
… catchup that doesn't catch this
  • Loading branch information
marta-lokhova committed Oct 15, 2024
1 parent 63140a6 commit 11544d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/catchup/VerifyLedgerChainWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ VerifyLedgerChainWork::verifyHistoryOfSingleCheckpoint()
CLOG_DEBUG(History, "Verifying ledger headers from {} for checkpoint {}",
ft.localPath_nogz(), mCurrCheckpoint);

auto const& hm = mApp.getHistoryManager();

while (hdrIn)
{
try
Expand Down Expand Up @@ -243,6 +245,15 @@ VerifyLedgerChainWork::verifyHistoryOfSingleCheckpoint()

if (beginCheckpoint)
{
if (!hm.isFirstLedgerInCheckpoint(curr.header.ledgerSeq))
{
CLOG_ERROR(
History, "Checkpoint did not start with {} - got {}",
hm.firstLedgerInCheckpointContaining(curr.header.ledgerSeq),
curr.header.ledgerSeq);
return HistoryManager::VERIFY_STATUS_ERR_MISSING_ENTRIES;
}

// At the beginning of checkpoint, we can't verify the link with
// previous ledger, so at least verify that header content hashes to
// correct value
Expand Down
3 changes: 3 additions & 0 deletions src/history/HistoryManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ HistoryManagerImpl::dropSQLBasedPublish()
populateCheckpointFilesFromDB(mApp, mApp.getDatabase().getSession(),
firstLedgerInCheckpointContaining(lcl),
freq, *mCheckpoint);
LedgerHeaderUtils::copyToStream(
mApp.getDatabase(), mApp.getDatabase().getSession(),
firstLedgerInCheckpointContaining(lcl), freq, *mCheckpoint);
}
mApp.getDatabase().clearPreparedStatementCache();

Expand Down

0 comments on commit 11544d9

Please sign in to comment.