mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Combine history_ledger_index and online_delete (RIPD-774)
This commit is contained in:
committed by
Nik Bougalis
parent
43873b1b2c
commit
5d6ea3d75f
@@ -481,13 +481,6 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# [ledger_history_index]
|
||||
#
|
||||
# If set to greater than 0, the index number of the earliest ledger to
|
||||
# acquire.
|
||||
#
|
||||
#
|
||||
#
|
||||
# [fetch_depth]
|
||||
#
|
||||
# The number of past ledgers to serve to other peers that request historical
|
||||
|
||||
@@ -103,8 +103,6 @@ public:
|
||||
|
||||
// How much history do we want to keep
|
||||
std::uint32_t const ledger_history_;
|
||||
// Acquire past ledgers down to this ledger index
|
||||
std::uint32_t const ledger_history_index_;
|
||||
|
||||
int const ledger_fetch_size_;
|
||||
|
||||
@@ -133,18 +131,8 @@ public:
|
||||
, standalone_ (config.RUN_STANDALONE)
|
||||
, fetch_depth_ (getApp ().getSHAMapStore ().clampFetchDepth (config.FETCH_DEPTH))
|
||||
, ledger_history_ (config.LEDGER_HISTORY)
|
||||
, ledger_history_index_ (config.LEDGER_HISTORY_INDEX)
|
||||
, ledger_fetch_size_ (config.getSize (siLedgerFetch))
|
||||
{
|
||||
if (ledger_history_index_ != 0 &&
|
||||
config.nodeDatabase["online_delete"].isNotEmpty () &&
|
||||
config.nodeDatabase["online_delete"].getIntValue () > 0)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "[node_db] online_delete option and [ledger_history_index]"
|
||||
" cannot be configured at the same time.";
|
||||
throw std::runtime_error (ss.str ());
|
||||
}
|
||||
}
|
||||
|
||||
~LedgerMasterImp ()
|
||||
@@ -959,7 +947,7 @@ public:
|
||||
WriteLog (lsTRACE, LedgerMaster) << "tryAdvance discovered missing " << missing;
|
||||
if ((missing != RangeSet::absent) && (missing > 0) &&
|
||||
shouldAcquire (mValidLedgerSeq, ledger_history_,
|
||||
ledger_history_index_, missing) &&
|
||||
getApp ().getSHAMapStore ().getCanDelete (), missing) &&
|
||||
((mFillInProgress == 0) || (missing > mFillInProgress)))
|
||||
{
|
||||
WriteLog (lsTRACE, LedgerMaster) << "advanceThread should acquire";
|
||||
@@ -1558,12 +1546,12 @@ LedgerMaster::~LedgerMaster ()
|
||||
{
|
||||
}
|
||||
|
||||
bool LedgerMaster::shouldAcquire (std::uint32_t currentLedger,
|
||||
std::uint32_t ledgerHistory, std::uint32_t ledgerHistoryIndex,
|
||||
std::uint32_t candidateLedger)
|
||||
bool LedgerMaster::shouldAcquire (std::uint32_t const currentLedger,
|
||||
std::uint32_t const ledgerHistory, std::uint32_t const ledgerHistoryIndex,
|
||||
std::uint32_t const candidateLedger)
|
||||
{
|
||||
bool ret (candidateLedger >= currentLedger ||
|
||||
(ledgerHistoryIndex != 0 && candidateLedger >= ledgerHistoryIndex) ||
|
||||
candidateLedger > ledgerHistoryIndex ||
|
||||
(currentLedger - candidateLedger) <= ledgerHistory);
|
||||
|
||||
WriteLog (lsTRACE, LedgerMaster)
|
||||
|
||||
@@ -344,7 +344,6 @@ int run (int argc, char** argv)
|
||||
{
|
||||
getConfig ().RUN_STANDALONE = true;
|
||||
getConfig ().LEDGER_HISTORY = 0;
|
||||
getConfig ().LEDGER_HISTORY_INDEX = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,9 @@ SHAMapStoreImp::run()
|
||||
transactionDb_ = &getApp().getTxnDB();
|
||||
ledgerDb_ = &getApp().getLedgerDB();
|
||||
|
||||
if (setup_.advisoryDelete)
|
||||
canDelete_ = state_db_.getCanDelete ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
healthy_ = true;
|
||||
@@ -326,8 +329,6 @@ SHAMapStoreImp::run()
|
||||
lastRotated = validatedSeq;
|
||||
state_db_.setLastRotated (lastRotated);
|
||||
}
|
||||
if (setup_.advisoryDelete)
|
||||
canDelete_ = state_db_.getCanDelete();
|
||||
|
||||
// will delete up to (not including) lastRotated)
|
||||
if (validatedSeq >= lastRotated + setup_.deleteInterval
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
LedgerIndex
|
||||
setCanDelete (LedgerIndex seq) override
|
||||
{
|
||||
if (setup_.advisoryDelete)
|
||||
canDelete_ = seq;
|
||||
return state_db_.setCanDelete (seq);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,6 @@ public:
|
||||
|
||||
// Node storage configuration
|
||||
std::uint32_t LEDGER_HISTORY;
|
||||
std::uint32_t LEDGER_HISTORY_INDEX;
|
||||
std::uint32_t FETCH_DEPTH;
|
||||
int NODE_SIZE;
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ struct ConfigSection
|
||||
#define SECTION_FEE_OWNER_RESERVE "fee_owner_reserve"
|
||||
#define SECTION_FETCH_DEPTH "fetch_depth"
|
||||
#define SECTION_LEDGER_HISTORY "ledger_history"
|
||||
#define SECTION_LEDGER_HISTORY_INDEX "ledger_history_index"
|
||||
#define SECTION_INSIGHT "insight"
|
||||
#define SECTION_IPS "ips"
|
||||
#define SECTION_IPS_FIXED "ips_fixed"
|
||||
|
||||
@@ -248,7 +248,6 @@ Config::Config ()
|
||||
FEE_CONTRACT_OPERATION = DEFAULT_FEE_OPERATION;
|
||||
|
||||
LEDGER_HISTORY = 256;
|
||||
LEDGER_HISTORY_INDEX = 0;
|
||||
FETCH_DEPTH = 1000000000;
|
||||
|
||||
// An explanation of these magical values would be nice.
|
||||
@@ -584,10 +583,6 @@ void Config::load ()
|
||||
else
|
||||
LEDGER_HISTORY = beast::lexicalCastThrow <std::uint32_t> (strTemp);
|
||||
}
|
||||
if (getSingleSection(secConfig, SECTION_LEDGER_HISTORY_INDEX, strTemp))
|
||||
{
|
||||
LEDGER_HISTORY_INDEX = beast::lexicalCastThrow <std::uint32_t>(strTemp);
|
||||
}
|
||||
|
||||
if (getSingleSection (secConfig, SECTION_FETCH_DEPTH, strTemp))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user