Skip to content

Commit

Permalink
Removed LedgerEntry SQL code
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Oct 10, 2024
1 parent 2c65abb commit 94b908b
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 4,341 deletions.
37 changes: 8 additions & 29 deletions src/bucket/test/BucketManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,15 @@ TEST_CASE("skip list", "[bucket][bucketmanager]")

TEST_CASE_VERSIONS("bucketmanager ownership", "[bucket][bucketmanager]")
{
auto test = [&](bool bucketListDB) {
VirtualClock clock;
Config cfg = getTestConfig();

// Make sure all Buckets serialize indexes to disk for test
cfg.BUCKETLIST_DB_INDEX_CUTOFF = 0;
cfg.MANUAL_CLOSE = false;
VirtualClock clock;
Config cfg = getTestConfig();

if (bucketListDB)
{
// Enable BucketListDB with persistent indexes
cfg.NODE_IS_VALIDATOR = false;
cfg.FORCE_SCP = false;
}
// Make sure all Buckets serialize indexes to disk for test
cfg.BUCKETLIST_DB_INDEX_CUTOFF = 0;
cfg.MANUAL_CLOSE = false;

for_versions_with_differing_bucket_logic(cfg, [&](Config const& cfg) {
for_versions_with_differing_bucket_logic(
cfg, [&](Config const& cfg) {
Application::pointer app = createTestApplication(clock, cfg);

std::vector<LedgerEntry> live(
Expand Down Expand Up @@ -242,10 +235,7 @@ TEST_CASE_VERSIONS("bucketmanager ownership", "[bucket][bucketmanager]")
std::string indexFilename =
app->getBucketManager().bucketIndexFilename(b->getHash());
CHECK(fs::exists(filename));
if (bucketListDB)
{
CHECK(fs::exists(indexFilename));
}
CHECK(fs::exists(indexFilename));

b.reset();
app->getBucketManager().forgetUnreferencedBuckets();
Expand Down Expand Up @@ -284,17 +274,6 @@ TEST_CASE_VERSIONS("bucketmanager ownership", "[bucket][bucketmanager]")
// Drop it again.
dropBucket(b1);
});
};

SECTION("BucketListDB")
{
test(true);
}

SECTION("SQL")
{
test(false);
}
}

TEST_CASE("bucketmanager missing buckets fail", "[bucket][bucketmanager]")
Expand Down
45 changes: 0 additions & 45 deletions src/ledger/InMemoryLedgerTxnRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,56 +108,11 @@ InMemoryLedgerTxnRoot::deleteOffersModifiedOnOrAfterLedger(
{
}

void
InMemoryLedgerTxnRoot::dropAccounts(bool)
{
}

void
InMemoryLedgerTxnRoot::dropData(bool)
{
}

void
InMemoryLedgerTxnRoot::dropOffers(bool)
{
}

void
InMemoryLedgerTxnRoot::dropTrustLines(bool)
{
}

void
InMemoryLedgerTxnRoot::dropClaimableBalances(bool)
{
}

void
InMemoryLedgerTxnRoot::dropLiquidityPools(bool)
{
}

void
InMemoryLedgerTxnRoot::dropContractData(bool)
{
}

void
InMemoryLedgerTxnRoot::dropContractCode(bool)
{
}

void
InMemoryLedgerTxnRoot::dropConfigSettings(bool)
{
}

void
InMemoryLedgerTxnRoot::dropTTL(bool)
{
}

double
InMemoryLedgerTxnRoot::getPrefetchHitRate() const
{
Expand Down
9 changes: 0 additions & 9 deletions src/ledger/InMemoryLedgerTxnRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,7 @@ class InMemoryLedgerTxnRoot : public AbstractLedgerTxnParent

void deleteOffersModifiedOnOrAfterLedger(uint32_t ledger) const override;

void dropAccounts(bool rebuild) override;
void dropData(bool rebuild) override;
void dropOffers(bool rebuild) override;
void dropTrustLines(bool rebuild) override;
void dropClaimableBalances(bool rebuild) override;
void dropLiquidityPools(bool rebuild) override;
void dropContractData(bool rebuild) override;
void dropContractCode(bool rebuild) override;
void dropConfigSettings(bool rebuild) override;
void dropTTL(bool rebuild) override;
double getPrefetchHitRate() const override;
uint32_t prefetchClassic(UnorderedSet<LedgerKey> const& keys) override;
uint32_t prefetchSoroban(UnorderedSet<LedgerKey> const& keys,
Expand Down
109 changes: 0 additions & 109 deletions src/ledger/LedgerTxn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2022,67 +2022,12 @@ LedgerTxn::deleteOffersModifiedOnOrAfterLedger(uint32_t ledger) const
"called deleteOffersModifiedOnOrAfterLedger on non-root LedgerTxn");
}

void
LedgerTxn::dropAccounts(bool rebuild)
{
throw std::runtime_error("called dropAccounts on non-root LedgerTxn");
}

void
LedgerTxn::dropData(bool rebuild)
{
throw std::runtime_error("called dropData on non-root LedgerTxn");
}

void
LedgerTxn::dropOffers(bool rebuild)
{
throw std::runtime_error("called dropOffers on non-root LedgerTxn");
}

void
LedgerTxn::dropTrustLines(bool rebuild)
{
throw std::runtime_error("called dropTrustLines on non-root LedgerTxn");
}

void
LedgerTxn::dropClaimableBalances(bool rebuild)
{
throw std::runtime_error(
"called dropClaimableBalances on non-root LedgerTxn");
}

void
LedgerTxn::dropLiquidityPools(bool rebuild)
{
throw std::runtime_error("called dropLiquidityPools on non-root LedgerTxn");
}

void
LedgerTxn::dropContractData(bool rebuild)
{
throw std::runtime_error("called dropContractData on non-root LedgerTxn");
}

void
LedgerTxn::dropContractCode(bool rebuild)
{
throw std::runtime_error("called dropContractCode on non-root LedgerTxn");
}

void
LedgerTxn::dropConfigSettings(bool rebuild)
{
throw std::runtime_error("called dropConfigSettings on non-root LedgerTxn");
}

void
LedgerTxn::dropTTL(bool rebuild)
{
throw std::runtime_error("called dropTTL on non-root LedgerTxn");
}

double
LedgerTxn::getPrefetchHitRate() const
{
Expand Down Expand Up @@ -2796,66 +2741,12 @@ LedgerTxnRoot::Impl::deleteOffersModifiedOnOrAfterLedger(uint32_t ledger) const
mApp.getDatabase().getSession() << query, use(ledger);
}

void
LedgerTxnRoot::dropAccounts(bool rebuild)
{
mImpl->dropAccounts(rebuild);
}

void
LedgerTxnRoot::dropData(bool rebuild)
{
mImpl->dropData(rebuild);
}

void
LedgerTxnRoot::dropOffers(bool rebuild)
{
mImpl->dropOffers(rebuild);
}

void
LedgerTxnRoot::dropTrustLines(bool rebuild)
{
mImpl->dropTrustLines(rebuild);
}

void
LedgerTxnRoot::dropClaimableBalances(bool rebuild)
{
mImpl->dropClaimableBalances(rebuild);
}

void
LedgerTxnRoot::dropLiquidityPools(bool rebuild)
{
mImpl->dropLiquidityPools(rebuild);
}

void
LedgerTxnRoot::dropContractData(bool rebuild)
{
mImpl->dropContractData(rebuild);
}

void
LedgerTxnRoot::dropContractCode(bool rebuild)
{
mImpl->dropContractCode(rebuild);
}

void
LedgerTxnRoot::dropConfigSettings(bool rebuild)
{
mImpl->dropConfigSettings(rebuild);
}

void
LedgerTxnRoot::dropTTL(bool rebuild)
{
mImpl->dropTTL(rebuild);
}

uint32_t
LedgerTxnRoot::prefetchClassic(UnorderedSet<LedgerKey> const& keys)
{
Expand Down
54 changes: 0 additions & 54 deletions src/ledger/LedgerTxn.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,46 +472,10 @@ class AbstractLedgerTxnParent
// when called on anything other than a (real or stub) root LedgerTxn.
virtual void deleteOffersModifiedOnOrAfterLedger(uint32_t ledger) const = 0;

// Delete all account ledger entries in the database. Will throw when called
// on anything other than a (real or stub) root LedgerTxn.
virtual void dropAccounts(bool rebuild) = 0;

// Delete all account-data ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropData(bool rebuild) = 0;

// Delete all offer ledger entries. Will throw when called on anything other
// than a (real or stub) root LedgerTxn.
virtual void dropOffers(bool rebuild) = 0;

// Delete all trustline ledger entries. Will throw when called on anything
// other than a (real or stub) root LedgerTxn.
virtual void dropTrustLines(bool rebuild) = 0;

// Delete all claimable balance ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropClaimableBalances(bool rebuild) = 0;

// Delete all liquidity pool ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropLiquidityPools(bool rebuild) = 0;

// Delete all contract data ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropContractData(bool rebuild) = 0;

// Delete all contract code ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropContractCode(bool rebuild) = 0;

// Delete all config setting ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropConfigSettings(bool rebuild) = 0;

// Delete all ttl ledger entries. Will throw when called on
// anything other than a (real or stub) root LedgerTxn.
virtual void dropTTL(bool rebuild) = 0;

// Return the current cache hit rate for prefetched ledger entries, as a
// fraction from 0.0 to 1.0. Will throw when called on anything other than a
// (real or stub) root LedgerTxn.
Expand Down Expand Up @@ -811,16 +775,7 @@ class LedgerTxn : public AbstractLedgerTxn

uint64_t countOffers(LedgerRange const& ledgers) const override;
void deleteOffersModifiedOnOrAfterLedger(uint32_t ledger) const override;
void dropAccounts(bool rebuild) override;
void dropData(bool rebuild) override;
void dropOffers(bool rebuild) override;
void dropTrustLines(bool rebuild) override;
void dropClaimableBalances(bool rebuild) override;
void dropLiquidityPools(bool rebuild) override;
void dropContractData(bool rebuild) override;
void dropContractCode(bool rebuild) override;
void dropConfigSettings(bool rebuild) override;
void dropTTL(bool rebuild) override;

double getPrefetchHitRate() const override;
uint32_t prefetchClassic(UnorderedSet<LedgerKey> const& keys) override;
Expand Down Expand Up @@ -875,16 +830,7 @@ class LedgerTxnRoot : public AbstractLedgerTxnParent

void deleteOffersModifiedOnOrAfterLedger(uint32_t ledger) const override;

void dropAccounts(bool rebuild) override;
void dropData(bool rebuild) override;
void dropOffers(bool rebuild) override;
void dropTrustLines(bool rebuild) override;
void dropClaimableBalances(bool rebuild) override;
void dropLiquidityPools(bool rebuild) override;
void dropContractData(bool rebuild) override;
void dropContractCode(bool rebuild) override;
void dropConfigSettings(bool rebuild) override;
void dropTTL(bool rebuild) override;

#ifdef BUILD_TESTS
void resetForFuzzer() override;
Expand Down
Loading

0 comments on commit 94b908b

Please sign in to comment.