From 6a079eddee582d255f0163dce3ec1b3d1afef7ac Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Mon, 11 May 2026 00:22:13 +0200 Subject: [PATCH] revert --- include/xrpl/nodestore/Database.h | 12 -------- .../nodestore/detail/DatabaseRotatingImp.h | 2 -- src/libxrpl/nodestore/Database.cpp | 29 ------------------- src/libxrpl/nodestore/DatabaseNodeImp.cpp | 1 - src/libxrpl/nodestore/DatabaseRotatingImp.cpp | 9 +----- 5 files changed, 1 insertion(+), 52 deletions(-) diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index 7848e36419..ca2dde560c 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -3,14 +3,12 @@ #include #include #include -#include #include #include #include #include #include -#include namespace xrpl::NodeStore { @@ -224,12 +222,6 @@ protected: void importInternal(Backend& dstBackend, Database& srcDB); - void - negCacheErase(uint256 const& hash); - - void - negCacheClear(); - void updateFetchMetrics(uint64_t fetches, uint64_t hits, uint64_t duration) { @@ -259,10 +251,6 @@ private: std::atomic readThreads_ = 0; std::atomic runningThreads_ = 0; - mutable std::mutex negCacheMutex_; - std::unordered_set> negCache_; - static constexpr std::size_t kNegCacheMax = 100'000; - virtual std::shared_ptr fetchNodeObject( uint256 const& hash, diff --git a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h index c5d5648bb7..39441ef4d8 100644 --- a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h +++ b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h @@ -2,7 +2,6 @@ #include -#include #include namespace xrpl::NodeStore { @@ -60,7 +59,6 @@ private: std::shared_ptr writableBackend_; std::shared_ptr archiveBackend_; mutable std::mutex mutex_; - std::atomic archiveHasData_{true}; std::shared_ptr fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) diff --git a/src/libxrpl/nodestore/Database.cpp b/src/libxrpl/nodestore/Database.cpp index a95a9e5f05..307b818918 100644 --- a/src/libxrpl/nodestore/Database.cpp +++ b/src/libxrpl/nodestore/Database.cpp @@ -242,15 +242,6 @@ Database::fetchNodeObject( { TRACE_FUNC(); - { - std::scoped_lock const lock(negCacheMutex_); - if (negCache_.count(hash)) - { - ++fetchTotalCount_; - return nullptr; - } - } - FetchReport fetchReport(fetchType); using namespace std::chrono; @@ -264,12 +255,6 @@ Database::fetchNodeObject( ++fetchHitCount_; fetchSz_ += nodeObject->getData().size(); } - else - { - std::scoped_lock const lock(negCacheMutex_); - if (negCache_.size() < kNegCacheMax) - negCache_.insert(hash); - } ++fetchTotalCount_; fetchReport.elapsed = duration_cast(dur); @@ -277,20 +262,6 @@ Database::fetchNodeObject( return nodeObject; } -void -Database::negCacheErase(uint256 const& hash) -{ - std::scoped_lock const lock(negCacheMutex_); - negCache_.erase(hash); -} - -void -Database::negCacheClear() -{ - std::scoped_lock const lock(negCacheMutex_); - negCache_.clear(); -} - void Database::getCountsJson(json::Value& obj) { diff --git a/src/libxrpl/nodestore/DatabaseNodeImp.cpp b/src/libxrpl/nodestore/DatabaseNodeImp.cpp index c87dfe9c55..fe3fd8eb86 100644 --- a/src/libxrpl/nodestore/DatabaseNodeImp.cpp +++ b/src/libxrpl/nodestore/DatabaseNodeImp.cpp @@ -31,7 +31,6 @@ DatabaseNodeImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, st auto obj = NodeObject::createObject(type, std::move(data), hash); backend_->store(obj); - negCacheErase(hash); } void diff --git a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp index 671169766d..7568d1f61d 100644 --- a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp +++ b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp @@ -34,7 +34,6 @@ DatabaseRotatingImp::DatabaseRotatingImp( : DatabaseRotating(scheduler, readThreads, config, j) , writableBackend_(std::move(writableBackend)) , archiveBackend_(std::move(archiveBackend)) - , archiveHasData_(!get(config, "fresh_sync", false)) { TRACE_FUNC(); if (writableBackend_) @@ -68,8 +67,6 @@ DatabaseRotatingImp::rotate( writableBackend_ = std::move(newBackend); } - archiveHasData_.store(true, std::memory_order_relaxed); - negCacheClear(); f(newWritableBackendName, newArchiveBackendName); } @@ -122,7 +119,6 @@ DatabaseRotatingImp::store(NodeObjectType type, Blob&& data, uint256 const& hash backend->store(nObj); storeStats(1, nObj->getData().size()); - negCacheErase(hash); } std::shared_ptr @@ -172,14 +168,11 @@ DatabaseRotatingImp::fetchNodeObject( // Try to fetch from the writable backend nodeObject = fetch(writable); - if (!nodeObject && archiveHasData_.load(std::memory_order_relaxed)) + if (!nodeObject) { - // Only try archive if it's known to have data nodeObject = fetch(archive); if (nodeObject) { - archiveHasData_.store(true, std::memory_order_relaxed); - { // Refresh the writable backend pointer std::scoped_lock const lock(mutex_);