diff --git a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp index 4b5d1ee2d8..c83d79e20e 100644 --- a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp +++ b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp @@ -140,7 +140,7 @@ DatabaseRotatingImp::sweep() std::shared_ptr 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); } }