From e7da485373e538874f1e7bf0d8ba9d5a2cb947f4 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 26 Jun 2013 15:09:18 -0700 Subject: [PATCH] Don't crash on startup due to races on the hash node database. Setup checkpointing on it. --- src/cpp/ripple/ripple_Application.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/cpp/ripple/ripple_Application.cpp b/src/cpp/ripple/ripple_Application.cpp index 49cbeecd0..6220b42c1 100644 --- a/src/cpp/ripple/ripple_Application.cpp +++ b/src/cpp/ripple/ripple_Application.cpp @@ -457,6 +457,18 @@ void Application::setup () } } + if (!mHashedObjectStore.isLevelDB ()) + { + theApp->getHashNodeDB ()->getDB ()->executeSQL (boost::str (boost::format ("PRAGMA cache_size=-%d;") % + (theConfig.getSize (siHashNodeDBCache) * 1024))); + theApp->getHashNodeDB ()->getDB ()->setupCheckpointing (&mJobQueue); + } + + theApp->getLedgerDB ()->getDB ()->executeSQL (boost::str (boost::format ("PRAGMA cache_size=-%d;") % + (theConfig.getSize (siLgrDBCache) * 1024))); + theApp->getTxnDB ()->getDB ()->executeSQL (boost::str (boost::format ("PRAGMA cache_size=-%d;") % + (theConfig.getSize (siTxnDBCache) * 1024))); + mTxnDB->getDB ()->setupCheckpointing (&mJobQueue); mLedgerDB->getDB ()->setupCheckpointing (&mJobQueue); @@ -514,15 +526,6 @@ void Application::setup () mLedgerMaster.setMinValidations (theConfig.VALIDATION_QUORUM); - if (!mHashedObjectStore.isLevelDB ()) - theApp->getHashNodeDB ()->getDB ()->executeSQL (boost::str (boost::format ("PRAGMA cache_size=-%d;") % - (theConfig.getSize (siHashNodeDBCache) * 1024))); - - theApp->getLedgerDB ()->getDB ()->executeSQL (boost::str (boost::format ("PRAGMA cache_size=-%d;") % - (theConfig.getSize (siLgrDBCache) * 1024))); - theApp->getTxnDB ()->getDB ()->executeSQL (boost::str (boost::format ("PRAGMA cache_size=-%d;") % - (theConfig.getSize (siTxnDBCache) * 1024))); - // // Allow peer connections. //