mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 00:36:48 +00:00
revert
This commit is contained in:
@@ -3,14 +3,12 @@
|
||||
#include <xrpl/basics/BasicConfig.h>
|
||||
#include <xrpl/basics/Log.h>
|
||||
#include <xrpl/basics/TaggedCache.ipp>
|
||||
#include <xrpl/beast/hash/uhash.h>
|
||||
#include <xrpl/nodestore/Backend.h>
|
||||
#include <xrpl/nodestore/NodeObject.h>
|
||||
#include <xrpl/nodestore/Scheduler.h>
|
||||
#include <xrpl/protocol/SystemParameters.h>
|
||||
|
||||
#include <condition_variable>
|
||||
#include <unordered_set>
|
||||
|
||||
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<int> readThreads_ = 0;
|
||||
std::atomic<int> runningThreads_ = 0;
|
||||
|
||||
mutable std::mutex negCacheMutex_;
|
||||
std::unordered_set<uint256, beast::Uhash<>> negCache_;
|
||||
static constexpr std::size_t kNegCacheMax = 100'000;
|
||||
|
||||
virtual std::shared_ptr<NodeObject>
|
||||
fetchNodeObject(
|
||||
uint256 const& hash,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <xrpl/nodestore/DatabaseRotating.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
namespace xrpl::NodeStore {
|
||||
@@ -60,7 +59,6 @@ private:
|
||||
std::shared_ptr<Backend> writableBackend_;
|
||||
std::shared_ptr<Backend> archiveBackend_;
|
||||
mutable std::mutex mutex_;
|
||||
std::atomic<bool> archiveHasData_{true};
|
||||
|
||||
std::shared_ptr<NodeObject>
|
||||
fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate)
|
||||
|
||||
@@ -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<milliseconds>(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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,7 +34,6 @@ DatabaseRotatingImp::DatabaseRotatingImp(
|
||||
: DatabaseRotating(scheduler, readThreads, config, j)
|
||||
, writableBackend_(std::move(writableBackend))
|
||||
, archiveBackend_(std::move(archiveBackend))
|
||||
, archiveHasData_(!get<bool>(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<NodeObject>
|
||||
@@ -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_);
|
||||
|
||||
Reference in New Issue
Block a user