SHAMapStore Online Delete (RIPD-415):

Makes rippled configurable to support deletion of all data in its key-value
store (nodestore) and ledger and transaction SQLite databases based on
validated ledger sequence numbers. All records from a specified ledger
and forward shall remain available in the key-value store and SQLite, and
all data prior to that specific ledger may be deleted.

Additionally, the administrator may require that an RPC command be
executed to enable deletion. This is to align data deletion with local
policy.
This commit is contained in:
Mark Travis
2014-10-22 11:52:53 -07:00
committed by Nik Bougalis
parent b44974677e
commit 02529a0fc2
50 changed files with 1851 additions and 74 deletions

View File

@@ -26,6 +26,7 @@
#include <ripple/basics/Sustain.h>
#include <ripple/basics/seconds_clock.h>
#include <ripple/basics/make_SSLContext.h>
#include <ripple/app/misc/SHAMapStore.h>
#include <ripple/core/LoadFeeTrack.h>
#include <ripple/net/SNTPClient.h>
#include <ripple/nodestore/Database.h>
@@ -153,9 +154,12 @@ public:
beast::Journal m_journal;
Application::LockType m_masterMutex;
// These are not Stoppable-derived
std::unique_ptr <NodeStore::Manager> m_nodeStoreManager;
NodeStoreScheduler m_nodeStoreScheduler;
std::unique_ptr <SHAMapStore> m_shaMapStore;
std::unique_ptr <NodeStore::Database> m_nodeStore;
// These are not Stoppable-derived
NodeCache m_tempNodeCache;
TreeNodeCache m_treeNodeCache;
SLECache m_sleCache;
@@ -167,7 +171,6 @@ public:
std::unique_ptr <FullBelowCache> m_fullBelowCache;
// These are Stoppable-related
NodeStoreScheduler m_nodeStoreScheduler;
std::unique_ptr <JobQueue> m_jobQueue;
std::unique_ptr <SiteFiles::Manager> m_siteFiles;
std::unique_ptr <RPC::Manager> m_rpcManager;
@@ -179,7 +182,6 @@ public:
std::unique_ptr <NetworkOPs> m_networkOPs;
std::unique_ptr <UniqueNodeList> m_deprecatedUNL;
std::unique_ptr <ServerHandler> serverHandler_;
std::unique_ptr <NodeStore::Database> m_nodeStore;
std::unique_ptr <SNTPClient> m_sntpClient;
std::unique_ptr <Validators::Manager> m_validators;
std::unique_ptr <AmendmentTable> m_amendmentTable;
@@ -243,6 +245,15 @@ public:
std::move (make_Factories (
getConfig ().getSize(siHashNodeDBCache) * 1024))))
, m_nodeStoreScheduler (*this)
, m_shaMapStore (make_SHAMapStore (setup_SHAMapStore (
getConfig()), *this, *m_nodeStoreManager.get(),
m_nodeStoreScheduler, m_logs.journal ("SHAMapStore"),
m_logs.journal ("NodeObject"), m_txMaster))
, m_nodeStore (m_shaMapStore->makeDatabase ("NodeStore.main", 4))
, m_tempNodeCache ("NodeCache", 16384, 90, get_seconds_clock (),
m_logs.journal("TaggedCache"))
@@ -262,8 +273,6 @@ public:
"full_below", get_seconds_clock (), m_collectorManager->collector (),
fullBelowTargetSize, fullBelowExpirationSeconds))
, m_nodeStoreScheduler (*this)
// The JobQueue has to come pretty early since
// almost everything is a Stoppable child of the JobQueue.
//
@@ -307,11 +316,6 @@ public:
get_io_service(), *m_jobQueue, *m_networkOPs,
*m_resourceManager))
, m_nodeStore (m_nodeStoreManager->make_Database ("NodeStore.main",
m_nodeStoreScheduler, m_logs.journal("NodeObject"),
4, // four read threads for now
getConfig ().nodeDatabase, getConfig ().ephemeralNodeDatabase))
, m_sntpClient (SNTPClient::New (*this))
, m_validators (add (Validators::Manager::New (
@@ -509,6 +513,11 @@ public:
return *mProofOfWorkFactory;
}
SHAMapStore& getSHAMapStore () override
{
return *m_shaMapStore;
}
Overlay& overlay ()
{
return *m_overlay;
@@ -559,10 +568,29 @@ public:
assert (mLedgerDB.get () == nullptr);
assert (mWalletDB.get () == nullptr);
mRpcDB = std::make_unique <DatabaseCon> ("rpc.db", RpcDBInit, RpcDBCount);
mTxnDB = std::make_unique <DatabaseCon> ("transaction.db", TxnDBInit, TxnDBCount);
mLedgerDB = std::make_unique <DatabaseCon> ("ledger.db", LedgerDBInit, LedgerDBCount);
mWalletDB = std::make_unique <DatabaseCon> ("wallet.db", WalletDBInit, WalletDBCount);
DatabaseCon::Setup setup = setup_DatabaseCon (getConfig());
mRpcDB = std::make_unique <DatabaseCon> (setup, "rpc.db", RpcDBInit,
RpcDBCount);
mTxnDB = std::make_unique <DatabaseCon> (setup, "transaction.db",
TxnDBInit, TxnDBCount);
mLedgerDB = std::make_unique <DatabaseCon> (setup, "ledger.db",
LedgerDBInit, LedgerDBCount);
mWalletDB = std::make_unique <DatabaseCon> (setup, "wallet.db",
WalletDBInit, WalletDBCount);
if (setup.onlineDelete && mTxnDB && mLedgerDB)
{
{
std::lock_guard <std::recursive_mutex> lock (
mTxnDB->peekMutex());
mTxnDB->getDB()->executeSQL ("VACUUM;");
}
{
std::lock_guard <std::recursive_mutex> lock (
mLedgerDB->peekMutex());
mLedgerDB->getDB()->executeSQL ("VACUUM;");
}
}
return
mRpcDB.get() != nullptr &&
@@ -916,7 +944,7 @@ public:
&TransactionMaster::sweep, &m_txMaster));
logTimedCall (m_journal.warning, "NodeStore::sweep", __FILE__, __LINE__, std::bind (
&NodeStore::Database::sweep, m_nodeStore.get ()));
&NodeStore::Database::sweep, m_nodeStore.get()));
logTimedCall (m_journal.warning, "LedgerMaster::sweep", __FILE__, __LINE__, std::bind (
&LedgerMaster::sweep, m_ledgerMaster.get()));