Speed up access to ledger index value that can be deleted.

This commit is contained in:
Mark Travis
2015-01-21 19:07:50 -08:00
committed by Nik Bougalis
parent f3c1f63444
commit 9430f3665b
2 changed files with 9 additions and 7 deletions

View File

@@ -204,8 +204,8 @@ SHAMapStoreImp::SHAMapStoreImp (Setup const& setup,
, scheduler_ (scheduler)
, journal_ (journal)
, nodeStoreJournal_ (nodeStoreJournal)
, database_ (nullptr)
, transactionMaster_ (transactionMaster)
, canDelete_ (0)
{
if (setup_.deleteInterval)
{
@@ -326,17 +326,17 @@ SHAMapStoreImp::run()
lastRotated = validatedSeq;
state_db_.setLastRotated (lastRotated);
}
LedgerIndex canDelete = std::numeric_limits <LedgerIndex>::max();
canDelete_ = std::numeric_limits <LedgerIndex>::max();
if (setup_.advisoryDelete)
canDelete = state_db_.getCanDelete();
canDelete_ = state_db_.getCanDelete();
// will delete up to (not including) lastRotated)
if (validatedSeq >= lastRotated + setup_.deleteInterval
&& canDelete >= lastRotated - 1)
&& canDelete_ >= lastRotated - 1)
{
journal_.debug << "rotating validatedSeq " << validatedSeq
<< " lastRotated " << lastRotated << " deleteInterval "
<< setup_.deleteInterval << " canDelete " << canDelete;
<< setup_.deleteInterval << " canDelete_ " << canDelete_;
switch (health())
{