mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
[fold] rename rwdb
This commit is contained in:
@@ -538,7 +538,7 @@ target_sources (rippled PRIVATE
|
|||||||
subdir: nodestore
|
subdir: nodestore
|
||||||
#]===============================]
|
#]===============================]
|
||||||
src/ripple/nodestore/backend/CassandraFactory.cpp
|
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/MemoryFactory.cpp
|
||||||
src/ripple/nodestore/backend/FlatmapFactory.cpp
|
src/ripple/nodestore/backend/FlatmapFactory.cpp
|
||||||
src/ripple/nodestore/backend/NuDBFactory.cpp
|
src/ripple/nodestore/backend/NuDBFactory.cpp
|
||||||
|
|||||||
@@ -1056,7 +1056,18 @@
|
|||||||
# Cassandra is an alternative backend to be used only with Reporting Mode.
|
# Cassandra is an alternative backend to be used only with Reporting Mode.
|
||||||
# See the Reporting Mode section for more details about 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
|
# path Location to store the database
|
||||||
#
|
#
|
||||||
@@ -1112,7 +1123,8 @@
|
|||||||
# online_delete Minimum value of 256. Enable automatic purging
|
# online_delete Minimum value of 256. Enable automatic purging
|
||||||
# of older ledger information. Maintain at least this
|
# of older ledger information. Maintain at least this
|
||||||
# number of ledger records online. Must be greater
|
# 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
|
# These keys modify the behavior of online_delete, and thus are only
|
||||||
# relevant if online_delete is defined and non-zero:
|
# relevant if online_delete is defined and non-zero:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
class MemoryDatabase : public SQLiteDatabase
|
class RWDBDatabase : public SQLiteDatabase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct LedgerData
|
struct LedgerData
|
||||||
@@ -31,8 +31,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Application& app_;
|
Application& app_;
|
||||||
Config const& config_;
|
|
||||||
JobQueue& jobQueue_;
|
|
||||||
|
|
||||||
mutable std::shared_mutex mutex_;
|
mutable std::shared_mutex mutex_;
|
||||||
|
|
||||||
@@ -42,8 +40,8 @@ private:
|
|||||||
std::map<AccountID, AccountTxData> accountTxMap_;
|
std::map<AccountID, AccountTxData> accountTxMap_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemoryDatabase(Application& app, Config const& config, JobQueue& jobQueue)
|
RWDBDatabase(Application& app, Config const& config, JobQueue& jobQueue)
|
||||||
: app_(app), config_(config), jobQueue_(jobQueue)
|
: app_(app)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +566,7 @@ public:
|
|||||||
// No-op for in-memory database
|
// No-op for in-memory database
|
||||||
}
|
}
|
||||||
|
|
||||||
~MemoryDatabase()
|
~RWDBDatabase()
|
||||||
{
|
{
|
||||||
// Regular maps can use standard clear
|
// Regular maps can use standard clear
|
||||||
accountTxMap_.clear();
|
accountTxMap_.clear();
|
||||||
@@ -957,9 +955,9 @@ public:
|
|||||||
|
|
||||||
// Factory function
|
// Factory function
|
||||||
std::unique_ptr<SQLiteDatabase>
|
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
|
} // namespace ripple
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#include <ripple/app/main/Application.h>
|
#include <ripple/app/main/Application.h>
|
||||||
#include <ripple/app/rdb/RelationalDatabase.h>
|
#include <ripple/app/rdb/RelationalDatabase.h>
|
||||||
#include <ripple/app/rdb/backend/FlatmapDatabase.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/core/ConfigSections.h>
|
||||||
#include <ripple/nodestore/DatabaseShard.h>
|
#include <ripple/nodestore/DatabaseShard.h>
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ RelationalDatabase::init(
|
|||||||
{
|
{
|
||||||
bool use_sqlite = false;
|
bool use_sqlite = false;
|
||||||
bool use_postgres = false;
|
bool use_postgres = false;
|
||||||
bool use_memdb = false;
|
bool use_rwdb = false;
|
||||||
bool use_flatmap = false;
|
bool use_flatmap = false;
|
||||||
|
|
||||||
if (config.reporting())
|
if (config.reporting())
|
||||||
@@ -56,9 +56,9 @@ RelationalDatabase::init(
|
|||||||
{
|
{
|
||||||
use_sqlite = true;
|
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"))
|
else if (boost::iequals(get(rdb_section, "backend"), "flatmap"))
|
||||||
{
|
{
|
||||||
@@ -85,9 +85,9 @@ RelationalDatabase::init(
|
|||||||
{
|
{
|
||||||
return getPostgresDatabase(app, config, jobQueue);
|
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)
|
else if (use_flatmap)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -357,9 +357,9 @@ public:
|
|||||||
static bool const isMem =
|
static bool const isMem =
|
||||||
(!section(SECTION_RELATIONAL_DB).empty() &&
|
(!section(SECTION_RELATIONAL_DB).empty() &&
|
||||||
boost::beast::iequals(
|
boost::beast::iequals(
|
||||||
get(section(SECTION_RELATIONAL_DB), "backend"), "memdb")) ||
|
get(section(SECTION_RELATIONAL_DB), "backend"), "rwdb")) ||
|
||||||
(!section("node_db").empty() &&
|
(!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(
|
boost::beast::iequals(
|
||||||
get(section("node_db"), "type"), "flatmap")));
|
get(section("node_db"), "type"), "flatmap")));
|
||||||
// RHNOTE: memory type is not selected for here because it breaks
|
// RHNOTE: memory type is not selected for here because it breaks
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace NodeStore {
|
namespace NodeStore {
|
||||||
|
|
||||||
class MemDBBackend : public Backend
|
class RWDBBackend : public Backend
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string name_;
|
std::string name_;
|
||||||
@@ -40,7 +40,7 @@ private:
|
|||||||
DataStore table_;
|
DataStore table_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemDBBackend(
|
RWDBBackend(
|
||||||
size_t keyBytes,
|
size_t keyBytes,
|
||||||
Section const& keyValues,
|
Section const& keyValues,
|
||||||
beast::Journal journal)
|
beast::Journal journal)
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
name_ = "node_db";
|
name_ = "node_db";
|
||||||
}
|
}
|
||||||
|
|
||||||
~MemDBBackend() override
|
~RWDBBackend() override
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@@ -205,15 +205,15 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MemDBFactory : public Factory
|
class RWDBFactory : public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MemDBFactory()
|
RWDBFactory()
|
||||||
{
|
{
|
||||||
Manager::instance().insert(*this);
|
Manager::instance().insert(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~MemDBFactory() override
|
~RWDBFactory() override
|
||||||
{
|
{
|
||||||
Manager::instance().erase(*this);
|
Manager::instance().erase(*this);
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ public:
|
|||||||
std::string
|
std::string
|
||||||
getName() const override
|
getName() const override
|
||||||
{
|
{
|
||||||
return "MemDB";
|
return "RWDB";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Backend>
|
std::unique_ptr<Backend>
|
||||||
@@ -232,9 +232,11 @@ public:
|
|||||||
Scheduler& scheduler,
|
Scheduler& scheduler,
|
||||||
beast::Journal journal) override
|
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 NodeStore
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
@@ -141,7 +141,7 @@ OverlayImpl::OverlayImpl(
|
|||||||
app.config().section(SECTION_RELATIONAL_DB).empty() ||
|
app.config().section(SECTION_RELATIONAL_DB).empty() ||
|
||||||
!boost::iequals(
|
!boost::iequals(
|
||||||
get(app.config().section(SECTION_RELATIONAL_DB), "backend"),
|
get(app.config().section(SECTION_RELATIONAL_DB), "backend"),
|
||||||
"memory")))
|
"rwdb")))
|
||||||
, m_resolver(resolver)
|
, m_resolver(resolver)
|
||||||
, next_id_(1)
|
, next_id_(1)
|
||||||
, timer_count_(0)
|
, timer_count_(0)
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory backend does not keep table/data after close
|
// rwdb backend does not keep table/data after close
|
||||||
if (type != "memory")
|
if (type != "rwdb")
|
||||||
{
|
{
|
||||||
// Re-open the backend
|
// Re-open the backend
|
||||||
std::unique_ptr<Backend> backend = Manager::instance().make_Backend(
|
std::unique_ptr<Backend> backend = Manager::instance().make_Backend(
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
std::uint64_t const seedValue = 50;
|
std::uint64_t const seedValue = 50;
|
||||||
|
|
||||||
testBackend("memory", seedValue);
|
testBackend("memory", seedValue);
|
||||||
testBackend("memdb", seedValue);
|
testBackend("rwdb", seedValue);
|
||||||
testBackend("nudb", seedValue);
|
testBackend("nudb", seedValue);
|
||||||
|
|
||||||
#if RIPPLE_ROCKSDB_AVAILABLE
|
#if RIPPLE_ROCKSDB_AVAILABLE
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ public:
|
|||||||
|
|
||||||
testNodeStore("memory", false, seedValue);
|
testNodeStore("memory", false, seedValue);
|
||||||
|
|
||||||
testNodeStore("memdb", false, seedValue);
|
testNodeStore("rwdb", false, seedValue);
|
||||||
|
|
||||||
// Persistent backend tests
|
// Persistent backend tests
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user