Fix duplication of full below cache and tree node cache

This commit is contained in:
JoelKatz
2015-03-29 16:10:19 -07:00
committed by Tom Ritchford
parent 352db260b2
commit 9a0fa79144
4 changed files with 9 additions and 30 deletions

View File

@@ -262,12 +262,10 @@ public:
NodeCache m_tempNodeCache;
std::unique_ptr <CollectorManager> m_collectorManager;
detail::AppFamily family_;
TreeNodeCache m_treeNodeCache;
SLECache m_sleCache;
LocalCredentials m_localCredentials;
std::unique_ptr <Resource::Manager> m_resourceManager;
std::unique_ptr <FullBelowCache> m_fullBelowCache;
// These are Stoppable-related
std::unique_ptr <JobQueue> m_jobQueue;
@@ -343,19 +341,12 @@ public:
, family_ (*m_nodeStore, *m_collectorManager)
, m_treeNodeCache ("TreeNodeCache", 65536, 60, get_seconds_clock (),
deprecatedLogs().journal("TaggedCache"))
, m_sleCache ("LedgerEntryCache", 4096, 120, get_seconds_clock (),
m_logs.journal("TaggedCache"))
, m_resourceManager (Resource::make_Manager (
m_collectorManager->collector(), m_logs.journal("Resource")))
, m_fullBelowCache (std::make_unique <FullBelowCache> (
"full_below", get_seconds_clock (), m_collectorManager->collector (),
fullBelowTargetSize, fullBelowExpirationSeconds))
// The JobQueue has to come pretty early since
// almost everything is a Stoppable child of the JobQueue.
//
@@ -469,11 +460,6 @@ public:
return family_;
}
FullBelowCache& getFullBelowCache ()
{
return *m_fullBelowCache;
}
JobQueue& getJobQueue ()
{
return *m_jobQueue;
@@ -536,11 +522,6 @@ public:
return m_tempNodeCache;
}
TreeNodeCache& getTreeNodeCache ()
{
return m_treeNodeCache;
}
NodeStore::Database& getNodeStore ()
{
return *m_nodeStore;
@@ -807,8 +788,8 @@ public:
m_ledgerMaster->tune (getConfig ().getSize (siLedgerSize), getConfig ().getSize (siLedgerAge));
m_sleCache.setTargetSize (getConfig ().getSize (siSLECacheSize));
m_sleCache.setTargetAge (getConfig ().getSize (siSLECacheAge));
m_treeNodeCache.setTargetSize (getConfig ().getSize (siTreeCacheSize));
m_treeNodeCache.setTargetAge (getConfig ().getSize (siTreeCacheAge));
family().treecache().setTargetSize (getConfig ().getSize (siTreeCacheSize));
family().treecache().setTargetAge (getConfig ().getSize (siTreeCacheAge));
//----------------------------------------------------------------------
//
@@ -1017,7 +998,7 @@ public:
// have listeners register for "onSweep ()" notification.
//
m_fullBelowCache->sweep ();
family_.fullbelow().sweep ();
logTimedCall (m_journal.warning, "TransactionMaster::sweep", __FILE__, __LINE__, std::bind (
&TransactionMaster::sweep, &m_txMaster));
@@ -1044,7 +1025,7 @@ public:
&AcceptedLedger::sweep);
logTimedCall (m_journal.warning, "SHAMap::sweep", __FILE__, __LINE__,std::bind (
&TreeNodeCache::sweep, &m_treeNodeCache));
&TreeNodeCache::sweep, &family().treecache()));
logTimedCall (m_journal.warning, "NetworkOPs::sweepFetchPack", __FILE__, __LINE__, std::bind (
&NetworkOPs::sweepFetchPack, m_networkOPs.get ()));

View File

@@ -91,11 +91,9 @@ public:
virtual boost::asio::io_service& getIOService () = 0;
virtual CollectorManager& getCollectorManager () = 0;
virtual shamap::Family& family() = 0;
virtual FullBelowCache& getFullBelowCache () = 0;
virtual JobQueue& getJobQueue () = 0;
virtual RPC::Manager& getRPCManager () = 0;
virtual NodeCache& getTempNodeCache () = 0;
virtual TreeNodeCache& getTreeNodeCache () = 0;
virtual SLECache& getSLECache () = 0;
virtual Validators::Manager& getValidators () = 0;
virtual AmendmentTable& getAmendmentTable() = 0;

View File

@@ -265,8 +265,8 @@ SHAMapStoreImp::run()
LedgerIndex lastRotated = state_db_.getState().lastRotated;
netOPs_ = &getApp().getOPs();
ledgerMaster_ = &getApp().getLedgerMaster();
fullBelowCache_ = &getApp().getFullBelowCache();
treeNodeCache_ = &getApp().getTreeNodeCache();
fullBelowCache_ = &getApp().family().fullbelow();
treeNodeCache_ = &getApp().family().treecache();
transactionDb_ = &getApp().getTxnDB();
ledgerDb_ = &getApp().getLedgerDB();

View File

@@ -75,9 +75,9 @@ Json::Value doGetCounts (RPC::Context& context)
ret[jss::ledger_hit_rate] = app.getLedgerMaster ().getCacheHitRate ();
ret[jss::AL_hit_rate] = AcceptedLedger::getCacheHitRate ();
ret[jss::fullbelow_size] = static_cast<int>(app.getFullBelowCache().size());
ret[jss::treenode_cache_size] = app.getTreeNodeCache().getCacheSize();
ret[jss::treenode_track_size] = app.getTreeNodeCache().getTrackSize();
ret[jss::fullbelow_size] = static_cast<int>(app.family().fullbelow().size());
ret[jss::treenode_cache_size] = app.family().treecache().getCacheSize();
ret[jss::treenode_track_size] = app.family().treecache().getTrackSize();
std::string uptime;
int s = UptimeTimer::getInstance ().getElapsedSeconds ();