mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-27 09:00:32 +00:00
Count the number of explicitly duplicated nodes, and log it
- The "copied ledger" count may differ from the "Rotating:" count, because the latter will also count nodes from the cache.
This commit is contained in:
@@ -55,6 +55,9 @@ public:
|
||||
setRotationInFlight(LedgerIndex inFlight) = 0;
|
||||
virtual LedgerIndex
|
||||
getRotationInFlight() const = 0;
|
||||
|
||||
virtual std::uint64_t
|
||||
getDuplicationCount() const = 0;
|
||||
};
|
||||
|
||||
} // namespace xrpl::NodeStore
|
||||
|
||||
@@ -76,6 +76,9 @@ public:
|
||||
LedgerIndex
|
||||
getRotationInFlight() const override;
|
||||
|
||||
std::uint64_t
|
||||
getDuplicationCount() const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Backend> writableBackend_;
|
||||
std::shared_ptr<Backend> archiveBackend_;
|
||||
@@ -93,6 +96,9 @@ private:
|
||||
std::atomic<LedgerIndex> rotationInFlight_{0};
|
||||
std::atomic<std::uint64_t> copyForwardCount_{0};
|
||||
std::atomic<std::uint64_t> copyRejectCount_{0};
|
||||
// Duplication count tracks the number of nodes that are directly duplicated because they're in
|
||||
// the target ledger or cache.
|
||||
std::atomic<std::uint64_t> duplicationCount_{0};
|
||||
|
||||
std::shared_ptr<NodeObject>
|
||||
fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate)
|
||||
|
||||
@@ -56,6 +56,7 @@ DatabaseRotatingImp::rotate(
|
||||
std::shared_ptr<NodeStore::Backend> oldArchiveBackend;
|
||||
std::uint64_t copyForwards = 0;
|
||||
std::uint64_t copyRejects = 0;
|
||||
std::uint64_t duplications = 0;
|
||||
{
|
||||
std::scoped_lock const lock(mutex_);
|
||||
|
||||
@@ -69,6 +70,7 @@ DatabaseRotatingImp::rotate(
|
||||
|
||||
copyForwards = copyForwardCount_.exchange(0, std::memory_order_relaxed);
|
||||
copyRejects = copyRejectCount_.exchange(0, std::memory_order_relaxed);
|
||||
duplications = duplicationCount_.exchange(0, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
if (copyForwards > 0 || copyRejects > 0)
|
||||
@@ -78,6 +80,11 @@ DatabaseRotatingImp::rotate(
|
||||
"during the rotation window. Rejected "
|
||||
<< copyRejects;
|
||||
}
|
||||
if (duplications > 0)
|
||||
{
|
||||
JLOG(j_.warn()) << "Rotating: duplicated " << duplications
|
||||
<< " nodes into the writable backend for the current validated ledger.";
|
||||
}
|
||||
|
||||
f(newWritableBackendName, newArchiveBackendName);
|
||||
}
|
||||
@@ -95,6 +102,12 @@ DatabaseRotatingImp::getRotationInFlight() const
|
||||
return rotationInFlight_.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
std::uint64_t
|
||||
DatabaseRotatingImp::getDuplicationCount() const
|
||||
{
|
||||
return duplicationCount_.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
std::string
|
||||
DatabaseRotatingImp::getName() const
|
||||
{
|
||||
@@ -214,7 +227,11 @@ DatabaseRotatingImp::fetchNodeObject(
|
||||
writable = writableBackend_;
|
||||
}
|
||||
|
||||
if (!duplicate)
|
||||
if (duplicate)
|
||||
{
|
||||
duplicationCount_.fetch_add(1, std::memory_order_relaxed);
|
||||
}
|
||||
else
|
||||
{
|
||||
JLOG(j_.debug()) << "Rotating: copy node for ledger " << ledgerSeq
|
||||
<< " from archive to writable backend: " << hash;
|
||||
|
||||
@@ -451,7 +451,8 @@ SHAMapStoreImp::run()
|
||||
return;
|
||||
// Only log if we completed without a "health" abort
|
||||
JLOG(journal_.debug())
|
||||
<< "copied ledger " << validatedSeq << " nodecount " << nodeCount;
|
||||
<< "copied ledger " << validatedSeq << " duplicated "
|
||||
<< dbRotating_->getDuplicationCount() << " / " << nodeCount << " nodes";
|
||||
|
||||
JLOG(journal_.debug()) << "freshening caches";
|
||||
freshenCaches();
|
||||
|
||||
Reference in New Issue
Block a user