mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Unit tests for database shards
This commit is contained in:
@@ -325,8 +325,10 @@ public:
|
||||
|
||||
The Application network time is set to
|
||||
the close time of the resulting ledger.
|
||||
|
||||
@return true if no error, false if error
|
||||
*/
|
||||
void
|
||||
bool
|
||||
close(
|
||||
NetClock::time_point closeTime,
|
||||
boost::optional<std::chrono::milliseconds> consensusDelay =
|
||||
@@ -336,25 +338,29 @@ public:
|
||||
|
||||
The time is calculated as the duration from
|
||||
the previous ledger closing time.
|
||||
|
||||
@return true if no error, false if error
|
||||
*/
|
||||
template <class Rep, class Period>
|
||||
void
|
||||
bool
|
||||
close(std::chrono::duration<Rep, Period> const& elapsed)
|
||||
{
|
||||
// VFALCO Is this the correct time?
|
||||
close(now() + elapsed);
|
||||
return close(now() + elapsed);
|
||||
}
|
||||
|
||||
/** Close and advance the ledger.
|
||||
|
||||
The time is calculated as five seconds from
|
||||
the previous ledger closing time.
|
||||
|
||||
@return true if no error, false if error
|
||||
*/
|
||||
void
|
||||
bool
|
||||
close()
|
||||
{
|
||||
// VFALCO Is this the correct time?
|
||||
close(std::chrono::seconds(5));
|
||||
return close(std::chrono::seconds(5));
|
||||
}
|
||||
|
||||
/** Turn on JSON tracing.
|
||||
|
||||
@@ -107,13 +107,14 @@ Env::closed()
|
||||
return app().getLedgerMaster().getClosedLedger();
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Env::close(
|
||||
NetClock::time_point closeTime,
|
||||
boost::optional<std::chrono::milliseconds> consensusDelay)
|
||||
{
|
||||
// Round up to next distinguishable value
|
||||
using namespace std::chrono_literals;
|
||||
bool res = true;
|
||||
closeTime += closed()->info().closeTimeResolution - 1s;
|
||||
timeKeeper().set(closeTime);
|
||||
// Go through the rpc interface unless we need to simulate
|
||||
@@ -122,10 +123,17 @@ Env::close(
|
||||
app().getOPs().acceptLedger(consensusDelay);
|
||||
else
|
||||
{
|
||||
rpc("ledger_accept");
|
||||
// VFALCO No error check?
|
||||
auto resp = rpc("ledger_accept");
|
||||
if (resp["result"]["status"] != std::string("success"))
|
||||
{
|
||||
JLOG(journal.error())
|
||||
<< "Env::close() failed: " << resp["result"]["status"]
|
||||
<< std::endl;
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
timeKeeper().set(closed()->info().closeTime);
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
1019
src/test/nodestore/DatabaseShard_test.cpp
Normal file
1019
src/test/nodestore/DatabaseShard_test.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -167,6 +167,9 @@ public:
|
||||
section.set("path", tempDir.path());
|
||||
section.set("max_size_gb", "100");
|
||||
section.set("ledgers_per_shard", "256");
|
||||
section.set("earliest_seq", "257");
|
||||
auto& sectionNode = c->section(ConfigSection::nodeDatabase());
|
||||
sectionNode.set("earliest_seq", "257");
|
||||
c->setupControl(true, true, true);
|
||||
|
||||
jtx::Env env(*this, std::move(c));
|
||||
@@ -262,6 +265,9 @@ public:
|
||||
section.set("path", tempDir.path());
|
||||
section.set("max_size_gb", "100");
|
||||
section.set("ledgers_per_shard", "256");
|
||||
section.set("earliest_seq", "257");
|
||||
auto& sectionNode = c->section(ConfigSection::nodeDatabase());
|
||||
sectionNode.set("earliest_seq", "257");
|
||||
c->setupControl(true, true, true);
|
||||
|
||||
jtx::Env env(*this, std::move(c));
|
||||
@@ -358,6 +364,9 @@ public:
|
||||
section.set("ledgers_per_shard", "256");
|
||||
section.set("shard_verification_retry_interval", "1");
|
||||
section.set("shard_verification_max_attempts", "10000");
|
||||
section.set("earliest_seq", "257");
|
||||
auto& sectionNode = c->section(ConfigSection::nodeDatabase());
|
||||
sectionNode.set("earliest_seq", "257");
|
||||
c->setupControl(true, true, true);
|
||||
|
||||
jtx::Env env(*this, std::move(c));
|
||||
|
||||
Reference in New Issue
Block a user