[fold] rename rwdb

This commit is contained in:
Denis Angell
2024-11-11 23:08:51 +01:00
parent d33ee9605e
commit cac563038d
9 changed files with 44 additions and 32 deletions

View File

@@ -538,7 +538,7 @@ target_sources (rippled PRIVATE
subdir: nodestore
#]===============================]
src/ripple/nodestore/backend/CassandraFactory.cpp
src/ripple/nodestore/backend/MemDBFactory.cpp
src/ripple/nodestore/backend/RWDBFactory.cpp
src/ripple/nodestore/backend/MemoryFactory.cpp
src/ripple/nodestore/backend/FlatmapFactory.cpp
src/ripple/nodestore/backend/NuDBFactory.cpp

View File

@@ -1056,7 +1056,18 @@
# Cassandra is an alternative backend to be used only with Reporting Mode.
# See the Reporting Mode section for more details about Reporting Mode.
#
# Required keys for NuDB and RocksDB:
# type = RWDB
#
# RWDB is a high-performance memory store written by XRPL-Labs and optimized
# for xahaud. RWDB is NOT persistent and the data will be lost on restart.
# RWDB is recommended for Validator and Peer nodes that are not required to
# store history.
#
# RWDB maintains its high speed regardless of the amount of history
# stored. Online delete should NOT be used instead RWDB will use the
# ledger_history config value to determine how many ledgers to keep in memory.
#
# Required keys for NuDB, RWDB and RocksDB:
#
# path Location to store the database
#
@@ -1112,7 +1123,8 @@
# online_delete Minimum value of 256. Enable automatic purging
# of older ledger information. Maintain at least this
# number of ledger records online. Must be greater
# than or equal to ledger_history.
# than or equal to ledger_history. If using RWDB
# this value is ignored.
#
# These keys modify the behavior of online_delete, and thus are only
# relevant if online_delete is defined and non-zero:

View File

@@ -14,7 +14,7 @@
namespace ripple {
class MemoryDatabase : public SQLiteDatabase
class RWDBDatabase : public SQLiteDatabase
{
private:
struct LedgerData
@@ -31,8 +31,6 @@ private:
};
Application& app_;
Config const& config_;
JobQueue& jobQueue_;
mutable std::shared_mutex mutex_;
@@ -42,8 +40,8 @@ private:
std::map<AccountID, AccountTxData> accountTxMap_;
public:
MemoryDatabase(Application& app, Config const& config, JobQueue& jobQueue)
: app_(app), config_(config), jobQueue_(jobQueue)
RWDBDatabase(Application& app, Config const& config, JobQueue& jobQueue)
: app_(app)
{
}
@@ -568,7 +566,7 @@ public:
// No-op for in-memory database
}
~MemoryDatabase()
~RWDBDatabase()
{
// Regular maps can use standard clear
accountTxMap_.clear();
@@ -957,9 +955,9 @@ public:
// Factory function
std::unique_ptr<SQLiteDatabase>
getMemoryDatabase(Application& app, Config const& config, JobQueue& jobQueue)
getRWDBDatabase(Application& app, Config const& config, JobQueue& jobQueue)
{
return std::make_unique<MemoryDatabase>(app, config, jobQueue);
return std::make_unique<RWDBDatabase>(app, config, jobQueue);
}
} // namespace ripple

View File

@@ -20,7 +20,7 @@
#include <ripple/app/main/Application.h>
#include <ripple/app/rdb/RelationalDatabase.h>
#include <ripple/app/rdb/backend/FlatmapDatabase.h>
#include <ripple/app/rdb/backend/MemoryDatabase.h>
#include <ripple/app/rdb/backend/RWDBDatabase.h>
#include <ripple/core/ConfigSections.h>
#include <ripple/nodestore/DatabaseShard.h>
@@ -40,7 +40,7 @@ RelationalDatabase::init(
{
bool use_sqlite = false;
bool use_postgres = false;
bool use_memdb = false;
bool use_rwdb = false;
bool use_flatmap = false;
if (config.reporting())
@@ -56,9 +56,9 @@ RelationalDatabase::init(
{
use_sqlite = true;
}
else if (boost::iequals(get(rdb_section, "backend"), "memdb"))
else if (boost::iequals(get(rdb_section, "backend"), "rwdb"))
{
use_memdb = true;
use_rwdb = true;
}
else if (boost::iequals(get(rdb_section, "backend"), "flatmap"))
{
@@ -85,9 +85,9 @@ RelationalDatabase::init(
{
return getPostgresDatabase(app, config, jobQueue);
}
else if (use_memdb)
else if (use_rwdb)
{
return getMemoryDatabase(app, config, jobQueue);
return getRWDBDatabase(app, config, jobQueue);
}
else if (use_flatmap)
{

View File

@@ -357,9 +357,9 @@ public:
static bool const isMem =
(!section(SECTION_RELATIONAL_DB).empty() &&
boost::beast::iequals(
get(section(SECTION_RELATIONAL_DB), "backend"), "memdb")) ||
get(section(SECTION_RELATIONAL_DB), "backend"), "rwdb")) ||
(!section("node_db").empty() &&
(boost::beast::iequals(get(section("node_db"), "type"), "memdb") ||
(boost::beast::iequals(get(section("node_db"), "type"), "rwdb") ||
boost::beast::iequals(
get(section("node_db"), "type"), "flatmap")));
// RHNOTE: memory type is not selected for here because it breaks

View File

@@ -13,7 +13,7 @@
namespace ripple {
namespace NodeStore {
class MemDBBackend : public Backend
class RWDBBackend : public Backend
{
private:
std::string name_;
@@ -40,7 +40,7 @@ private:
DataStore table_;
public:
MemDBBackend(
RWDBBackend(
size_t keyBytes,
Section const& keyValues,
beast::Journal journal)
@@ -51,7 +51,7 @@ public:
name_ = "node_db";
}
~MemDBBackend() override
~RWDBBackend() override
{
close();
}
@@ -205,15 +205,15 @@ private:
}
};
class MemDBFactory : public Factory
class RWDBFactory : public Factory
{
public:
MemDBFactory()
RWDBFactory()
{
Manager::instance().insert(*this);
}
~MemDBFactory() override
~RWDBFactory() override
{
Manager::instance().erase(*this);
}
@@ -221,7 +221,7 @@ public:
std::string
getName() const override
{
return "MemDB";
return "RWDB";
}
std::unique_ptr<Backend>
@@ -232,9 +232,11 @@ public:
Scheduler& scheduler,
beast::Journal journal) override
{
return std::make_unique<MemDBBackend>(keyBytes, keyValues, journal);
return std::make_unique<RWDBBackend>(keyBytes, keyValues, journal);
}
};
static RWDBFactory rwDBFactory;
} // namespace NodeStore
} // namespace ripple

View File

@@ -141,7 +141,7 @@ OverlayImpl::OverlayImpl(
app.config().section(SECTION_RELATIONAL_DB).empty() ||
!boost::iequals(
get(app.config().section(SECTION_RELATIONAL_DB), "backend"),
"memory")))
"rwdb")))
, m_resolver(resolver)
, next_id_(1)
, timer_count_(0)

View File

@@ -82,8 +82,8 @@ public:
}
}
// Memory backend does not keep table/data after close
if (type != "memory")
// rwdb backend does not keep table/data after close
if (type != "rwdb")
{
// Re-open the backend
std::unique_ptr<Backend> backend = Manager::instance().make_Backend(
@@ -108,7 +108,7 @@ public:
std::uint64_t const seedValue = 50;
testBackend("memory", seedValue);
testBackend("memdb", seedValue);
testBackend("rwdb", seedValue);
testBackend("nudb", seedValue);
#if RIPPLE_ROCKSDB_AVAILABLE

View File

@@ -661,7 +661,7 @@ public:
testNodeStore("memory", false, seedValue);
testNodeStore("memdb", false, seedValue);
testNodeStore("rwdb", false, seedValue);
// Persistent backend tests
{