Skip to content

Commit

Permalink
Review comment, and handle case of online_delete not having
Browse files Browse the repository at this point in the history
happened before.
  • Loading branch information
mtrippled committed Apr 23, 2020
1 parent 0fff925 commit 885bfb1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion src/ripple/app/misc/SHAMapStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,34 @@ class SHAMapStore
virtual int fdRequired() const = 0;

/** If online deletion is enabled, return the minimum ledger
* to keep. */
* to keep online, which is the lower bound for attempting to acquire
* historical ledgers over the peer to peer network.
*
* This value is governed by the following circumstances:
*
* Upon process startup:
*
* With advisory_delete enabled and online_delete having been executed
* previously:
* Upon process startup, this value is set to one past the value
* that is allowed to be deleted. In other words, anything greater
* than what can be deleted should be acquired from the network and
* then retained. If nothing has yet been deleted, then do not
* rely upon the value of what is allowed to be deleted because it
* could cause fetching of more history than configured by
* ledger_history.
*
* Without advisory_delete or if online_delete has never executed:
* Upon process startup, this value is set to the earliest ledger
* that has been persisted in SQLite.
*
* Each time online_delete executes:
*
* Just prior to clearing SQL databases of historical ledgers, move
* the value forward to one past the greatest ledger being deleted.
* This minimizes fetching of ledgers that are in the process of being
* deleted.
*/
virtual std::optional<LedgerIndex> const minimumOnline() const = 0;
};

Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/misc/SHAMapStoreImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ SHAMapStoreImp::run()
transactionDb_ = &app_.getTxnDB();
ledgerDb_ = &app_.getLedgerDB();

if (advisoryDelete_)
if (advisoryDelete_ && state_db_.getState().lastRotated)
{
canDelete_ = state_db_.getCanDelete();
// On startup, don't acquire ledgers from the network that
Expand Down

0 comments on commit 885bfb1

Please sign in to comment.