Start setup to re-store nodes based on ledger index

This commit is contained in:
Ed Hennis
2026-07-14 21:21:31 -04:00
parent 67e4cd26d0
commit ca315a69a6

View File

@@ -140,7 +140,7 @@ DatabaseRotatingImp::sweep()
std::shared_ptr<NodeObject>
DatabaseRotatingImp::fetchNodeObject(
uint256 const& hash,
std::uint32_t,
std::uint32_t ledgerSeq,
FetchReport& fetchReport,
bool duplicate)
{
@@ -189,12 +189,6 @@ DatabaseRotatingImp::fetchNodeObject(
nodeObject = fetch(archive);
if (nodeObject)
{
{
// Refresh the writable backend pointer
std::scoped_lock const lock(mutex_);
writable = writableBackend_;
}
// Update writable backend with data from the archive backend.
// While a rotation is in flight, ordinary (duplicate == false)
// reads served by the archive are copied forward too: the
@@ -203,8 +197,18 @@ DatabaseRotatingImp::fetchNodeObject(
// otherwise survive only in RAM once the archive is dropped.
if (duplicate || rotationInFlight_.load(std::memory_order_acquire))
{
{
// Refresh the writable backend pointer
std::scoped_lock const lock(mutex_);
writable = writableBackend_;
}
if (!duplicate)
{
JLOG(j_.warn()) << "Rotating: copy node for ledger " << ledgerSeq
<< " from archive to writable backend: " << hash;
++copyForwardCount_;
}
writable->store(nodeObject);
}
}