Skip to content

Commit

Permalink
Revert "Add support for deterministic database shards (XRPLF#2688):"
Browse files Browse the repository at this point in the history
This reverts commit 4dc08f8.
  • Loading branch information
manojsdoshi committed Jul 22, 2020
1 parent 7b048b4 commit c086c0b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 780 deletions.
1 change: 0 additions & 1 deletion Builds/CMake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ target_sources (rippled PRIVATE
src/ripple/nodestore/impl/DatabaseNodeImp.cpp
src/ripple/nodestore/impl/DatabaseRotatingImp.cpp
src/ripple/nodestore/impl/DatabaseShardImp.cpp
src/ripple/nodestore/impl/DeterministicShard.cpp
src/ripple/nodestore/impl/DecodedBlob.cpp
src/ripple/nodestore/impl/DummyScheduler.cpp
src/ripple/nodestore/impl/EncodedBlob.cpp
Expand Down
19 changes: 0 additions & 19 deletions src/ripple/nodestore/Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,6 @@ class Backend
virtual void
open(bool createIfMissing = true) = 0;

/** Open the backend.
@param createIfMissing Create the database files if necessary.
@param appType Deterministic appType used to create a backend.
@param uid Deterministic uid used to create a backend.
@param salt Deterministic salt used to create a backend.
This allows the caller to catch exceptions.
*/
virtual void
open(
bool createIfMissing,
boost::optional<uint64_t> appType,
boost::optional<uint64_t> uid,
boost::optional<uint64_t> salt)
{
Throw<std::runtime_error>(std::string(
"Deterministic appType/uid/salt not supported by backend " +
getName()));
}

/** Close the backend.
This allows the caller to catch exceptions.
*/
Expand Down
103 changes: 0 additions & 103 deletions src/ripple/nodestore/DeterministicShard.md

This file was deleted.

35 changes: 5 additions & 30 deletions src/ripple/nodestore/backend/NuDBFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ namespace NodeStore {
class NuDBBackend : public Backend
{
public:
static constexpr std::uint64_t currentType = 1;
static constexpr std::uint64_t deterministicType = 0x5348524400000000ull;
/* "SHRD" in ASCII */
static constexpr std::uint64_t deterministicMask = 0xFFFFFFFF00000000ull;
static constexpr std::size_t currentType = 1;

beast::Journal const j_;
size_t const keyBytes_;
Expand Down Expand Up @@ -96,11 +93,7 @@ class NuDBBackend : public Backend
}

void
open(
bool createIfMissing,
boost::optional<uint64_t> appType,
boost::optional<uint64_t> uid,
boost::optional<uint64_t> salt) override
open(bool createIfMissing) override
{
using namespace boost::filesystem;
if (db_.is_open())
Expand All @@ -121,9 +114,8 @@ class NuDBBackend : public Backend
dp,
kp,
lp,
appType.value_or(currentType),
uid.value_or(nudb::make_uid()),
salt.value_or(nudb::make_salt()),
currentType,
nudb::make_salt(),
keyBytes_,
nudb::block_size(kp),
0.50,
Expand All @@ -136,27 +128,10 @@ class NuDBBackend : public Backend
db_.open(dp, kp, lp, ec);
if (ec)
Throw<nudb::system_error>(ec);

/** Old value currentType is accepted for appnum in traditional
* databases, new value is used for deterministic shard databases.
* New 64-bit value is constructed from fixed and random parts.
* Fixed part is bounded by bitmask deterministicMask,
* and the value of fixed part is deterministicType.
* Random part depends on the contents of the shard and may be any.
* The contents of appnum field should match either old or new rule.
*/
if (db_.appnum() != appType.value_or(currentType) &&
(appType ||
(db_.appnum() & deterministicMask) != deterministicType))
if (db_.appnum() != currentType)
Throw<std::runtime_error>("nodestore: unknown appnum");
}

void
open(bool createIfMissing) override
{
open(createIfMissing, boost::none, boost::none, boost::none);
}

void
close() override
{
Expand Down
Loading

0 comments on commit c086c0b

Please sign in to comment.