Compare commits

...

90 Commits

Author SHA1 Message Date
Ed Hennis
c2b6cbc2ba Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-15 11:28:16 -04:00
Ed Hennis
a24e543af3 fix: Allocate TaggedCache::getKeys() memory outside of lock (#7567)
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-07-15 13:30:20 +00:00
Ed Hennis
6c1ecb0bf1 Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-14 20:25:43 -04:00
Sophia Xie
a0fd1cce54 fix: Re-store nodes missing from both backends during online_delete rotation (#7763)
Co-authored-by: Valentin Balaschenko <13349202+vlntb@users.noreply.github.com>
2026-07-14 23:42:40 +00:00
Ed Hennis
6b77a258df Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-14 13:48:07 -04:00
Ed Hennis
677acd09ae Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-13 17:22:28 -04:00
Ed Hennis
31b206b802 Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-13 15:07:32 -04:00
Ed Hennis
43bbedae3b Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-13 12:49:55 -04:00
Ed Hennis
4f6831b11d Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-08 17:23:16 -04:00
Ed Hennis
da6e767865 Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-07 19:32:24 -04:00
Ed Hennis
d0e9e483f8 Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-07 15:50:20 -04:00
Ed Hennis
1f593f2efa Merge branch 'develop' into ximinez/assetsmaximum-wip 2026-07-02 11:18:19 -04:00
Ed Hennis
655ac9b1f8 Merge remote-tracking branch 'XRPLF/develop' into ximinez/assetsmaximum-wip
* XRPLF/develop:
  refactor: Retire InnerObjTemplate fix (7368)
  fix: Disable AMM creation with Vault shares (7666)
  test: Add tests for TMProofPathResponse and TMReplayDeltaResponse invalid hash/key sizes (7593)
  ci: [DEPENDABOT] bump actions/setup-python from 6.2.0 to 6.3.0 (7657)
  build: Don't reuse binaries between different C++ versions (7681)
  chore: Update pre-commit hooks && actions (7686)
  feat: Add an invariant to ensure object deletion also deletes its pseudo-account (7445)
  feat: Add Batch (XLS-56) V1_1 (6446)
2026-07-01 16:02:07 -04:00
Ed Hennis
557697a492 Merge commit 'ecf7f805c90538e177470febb0a3a5b989c60620' into ximinez/assetsmaximum-wip
* commit 'ecf7f805c90538e177470febb0a3a5b989c60620':
  feat: Introduce lending 1.1 amendment and add `MemoData` field to `VaultDelete` transaction (6324)
2026-07-01 16:00:26 -04:00
Ed Hennis
09b13c0218 Review feedback from @Tapanito: consistent assert
- Use consistent assertion macro.
- Also fixed a build error due to name migration.
2026-06-30 20:17:49 -04:00
Ed Hennis
cf83782225 Merge remote-tracking branch 'XRPLF/tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip
* XRPLF/tapanito/lending-fix-amendment: (30 commits)
  AI review
  chore: Use std::ranges where possible (7634)
  ci: Use macOS 26 Tahoe with apple-clang 21 (7601)
  build: Mark sec256k1 and mpt-crypto as transitive headers (7658)
  chore: Add a script to nicely format clang-tidy output (7650)
  chore: Enable most bugprone checks (7643)
  feat: Confidential Transfer for MPT (5860)
  fix: Use trustline balance direction to validate IOU PaymentMint/PaymentBurn (7584)
  fix: Unify freeze checks for pseudo-account deposit/withdraw (7382)
  fix: Block delegate tx from being queued (7640)
  undo noise-changes
  address review feedback
  address AI feedback
  fix: Regenerate protocol autogenerated files
  fix: remove unnecessary tests & clang-tidy
  post-merge cleanup
  fix: updates autogen files
  fix: errors introduced post-merge
  refactor: Rename fixLendingProtocolV1_1 to featureLendingProtocolV1_1 (6527)
  adds sfMemoData field to VaultDelete transaction (6356)
  ...
2026-06-30 14:51:58 -04:00
Vito Tumas
dffa0a0910 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-06-30 18:30:20 +02:00
Vito
8c56202c90 AI review 2026-06-30 13:56:03 +02:00
Vito Tumas
ba7d28f444 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-06-30 09:32:05 +02:00
Vito
f2591b1651 Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment 2026-06-29 12:59:21 +02:00
Vito
5bcaa0af12 undo noise-changes 2026-06-26 14:49:50 +02:00
Vito
60700c5cbb address review feedback 2026-06-26 14:46:11 +02:00
Vito
452f6ea046 address AI feedback 2026-06-26 14:45:00 +02:00
Vito
8a0e45c055 fix: Regenerate protocol autogenerated files 2026-06-26 14:44:49 +02:00
Vito
2b7ea64167 fix: remove unnecessary tests & clang-tidy 2026-06-26 14:44:49 +02:00
Vito
8ea3db6299 post-merge cleanup 2026-06-26 14:44:27 +02:00
Vito
5b7f5153e4 fix: updates autogen files 2026-06-26 14:44:02 +02:00
Vito
dc931df242 fix: errors introduced post-merge 2026-06-26 14:44:02 +02:00
Vito Tumas
ec2a5ab620 refactor: Rename fixLendingProtocolV1_1 to featureLendingProtocolV1_1 (#6527)
Use XRPL_FEATURE macro instead of XRPL_FIX since
LendingProtocolV1_1 is a feature amendment, not a fix.
Update all references in VaultDelete and related tests.
2026-06-26 14:44:01 +02:00
Vito Tumas
199fdeb09d adds sfMemoData field to VaultDelete transaction (#6356)
* adds sfMemoData field to VaultDelete transaction
2026-06-26 14:42:01 +02:00
Vito
cbd2855305 restores missing linebreak 2026-06-26 14:40:21 +02:00
Vito
36fe2ea590 fixes a typo 2026-06-26 14:40:21 +02:00
Vito
07fef06a53 adds lending v1.1 fix amendment 2026-06-26 14:40:17 +02:00
Ed Hennis
ec91ad1687 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-06-25 11:43:21 -04:00
Vito Tumas
35744453d5 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-06-25 14:42:50 +02:00
Vito Tumas
60252ab648 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-06-25 14:33:56 +02:00
Vito
88cc3dd15a fix: remove old files 2026-06-24 11:19:59 +02:00
Vito
2a9d394b69 Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment 2026-06-24 11:17:38 +02:00
Vito
2fa8305e95 fix: restore changes made to .github 2026-06-24 11:14:39 +02:00
Ed Hennis
a711ebc358 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-06-11 21:57:24 -04:00
Vito
3dd44ae18a address AI feedback 2026-06-09 11:05:24 +02:00
Ayaz Salikhov
9eaebf2eea ci: Use XRPLF/actions build-multiarch-image workflow (#7428) 2026-06-09 11:05:23 +02:00
Ayaz Salikhov
664b9ba5fe ci: Use new packaging images and don't cancel develop builds (#7417)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-06-09 11:05:23 +02:00
Vito Tumas
189f2d60bd Merge branch 'develop' into tapanito/lending-fix-amendment 2026-06-08 14:09:28 +02:00
Vito
beb8a1872d fix: Regenerate protocol autogenerated files 2026-06-08 12:07:19 +02:00
Vito
24db40e56c fix: remove unnecessary tests & clang-tidy 2026-06-08 11:57:42 +02:00
Vito
da4513d096 post-merge cleanup 2026-06-08 11:47:11 +02:00
Vito
2e2fddefe9 Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment
# Conflicts:
#	include/xrpl/ledger/helpers/LendingHelpers.h
#	include/xrpl/protocol/STAmount.h
#	include/xrpl/protocol/detail/features.macro
#	include/xrpl/protocol/detail/transactions.macro
#	src/libxrpl/tx/invariants/VaultInvariant.cpp
#	src/test/app/Invariants_test.cpp
#	src/test/app/LoanBroker_test.cpp
#	src/test/app/Loan_test.cpp
#	src/test/app/Vault_test.cpp
2026-06-08 11:28:35 +02:00
Vito
db997ecad9 chore: Reset VaultInvariant to develop state before merge
VaultInvariant changes parked in /tmp/vault-invariant-changes.patch
for later re-evaluation.
2026-06-08 11:19:05 +02:00
Ed Hennis
b7d9f5a357 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-04-01 11:45:40 -04:00
Vito
68e4fbdf2b Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment 2026-03-31 10:00:59 +02:00
Ed Hennis
6acf730b9b Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-03-30 21:29:44 -04:00
Vito
bb0a09ae21 Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment 2026-03-26 17:16:49 +01:00
Vito
d94232007f fix: updates autogen files 2026-03-24 14:34:54 +01:00
Vito
df8bfbe5af fix: errors introduced post-merge 2026-03-24 12:37:06 +01:00
Vito
347d1a19ef Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment 2026-03-24 12:35:50 +01:00
Vito Tumas
d65fab27a1 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-03-21 14:39:10 +01:00
Vito Tumas
b5d25c5ab1 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-03-18 18:39:43 +01:00
Vito Tumas
7222150095 refactor: Rename fixLendingProtocolV1_1 to featureLendingProtocolV1_1 (#6527)
Use XRPL_FEATURE macro instead of XRPL_FIX since
LendingProtocolV1_1 is a feature amendment, not a fix.
Update all references in VaultDelete and related tests.
2026-03-16 09:26:57 +01:00
Ed Hennis
a6519011d2 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-03-10 13:38:22 -04:00
Vito
a67da5c2ed Merge remote-tracking branch 'origin/develop' into tapanito/lending-fix-amendment 2026-03-09 11:34:59 +01:00
Ed Hennis
5c1b94f1d3 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-03-05 14:02:22 -04:00
Vito Tumas
d2f23b2f5b Merge branch 'develop' into tapanito/lending-fix-amendment 2026-03-05 14:29:35 +01:00
Vito Tumas
4067e5025f Add rounding to Vault invariants (#6217)
Co-authored-by: Ed Hennis <ed@ripple.com>
2026-03-05 10:38:42 +01:00
Ed Hennis
0017eb345a Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-03-04 17:12:21 -04:00
Vito Tumas
ed4330a7d6 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-03-04 11:26:33 +01:00
Ed Hennis
c2ca6907d4 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-03-03 21:49:37 -04:00
Vito Tumas
feba605998 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-03-03 15:38:14 +01:00
Vito
b322097529 fixes formatting errors 2026-03-03 13:51:15 +01:00
Vito Tumas
e159d27373 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-03-03 13:48:37 +01:00
Vito Tumas
ba53026006 adds sfMemoData field to VaultDelete transaction (#6356)
* adds sfMemoData field to VaultDelete transaction
2026-02-26 14:13:29 +01:00
Vito Tumas
34773080df Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-25 13:44:20 +01:00
Ed Hennis
3a30099db6 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-02-24 17:43:57 -04:00
Vito Tumas
3c3bd75991 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-24 14:40:31 +01:00
Ed Hennis
6766a176a3 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-02-23 13:28:22 -04:00
Vito Tumas
7459fe454d Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-23 12:17:17 +01:00
Ed Hennis
ecb2ba5e19 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-02-18 21:15:34 -04:00
Vito
106bf48725 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-18 18:29:08 +01:00
Vito Tumas
74c968d4e3 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-17 13:51:08 +01:00
Vito
167147281c Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-12 15:22:30 +01:00
Vito Tumas
ba60306610 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-11 17:46:20 +01:00
Vito Tumas
6674500896 Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-10 11:48:23 +01:00
Vito
c5d7ebe93d restores missing linebreak 2026-02-05 10:24:14 +01:00
Ed Hennis
8b4404b8c6 Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip 2026-02-04 22:25:38 -04:00
Ed Hennis
bfc0acc734 Merge remote-tracking branch 'upstream/develop' into ximinez/assetsmaximum-wip
* upstream/develop:
  chore: Update secp256k1 and openssl (6327)
  chore: Remove unnecessary script (6326)
  refactor: Replace include guards by '#pragma once' (6322)
  chore: Remove unity builds (6300)
  refactor: Add ServiceRegistry to help modularization (6222)
  fix: Deletes expired NFToken offers from ledger (5707)
  chore: Add .zed editor config directory to .gitignore (6317)
  docs: Update API changelog, add APIv2+APIv3 version documentation (6308)
  fix: Restore config changes that broke standalone mode (6301)
  chore: Add upper-case match for ARM64 in CompilationEnv (6315)
  ci: Update hashes of XRPLF/actions (6316)
  chore: Format all cmake files without comments (6294)
  chore: Add cmake-format pre-commit hook (6279)
  chore: Remove unnecessary `boost::system` requirement from conanfile (6290)
2026-02-04 21:21:57 -05:00
Ed Hennis
9f7f43c16e Merge commit '5f638f55536def0d88b970d1018a465a238e55f4' into ximinez/assetsmaximum-wip
* commit '5f638f55536def0d88b970d1018a465a238e55f4':
  chore: Set ColumnLimit to 120 in clang-format (6288)
2026-02-04 21:21:33 -05:00
Ed Hennis
8e98ba7564 Can I check globally? 2026-02-04 21:21:26 -05:00
Ed Hennis
d0b5ca9dab Merge branch 'develop' into tapanito/lending-fix-amendment 2026-02-04 18:21:55 -04:00
Vito
5e51893e9b fixes a typo 2026-02-04 11:31:58 +01:00
Vito
3422c11d02 adds lending v1.1 fix amendment 2026-02-04 11:30:41 +01:00
6 changed files with 134 additions and 5 deletions

View File

@@ -3,6 +3,9 @@
#include <xrpl/basics/IntrusivePointer.ipp>
#include <xrpl/basics/Log.h> // IWYU pragma: keep
#include <xrpl/basics/TaggedCache.h>
#include <xrpl/basics/scope.h>
#include <algorithm>
namespace xrpl {
@@ -601,8 +604,42 @@ TaggedCache<Key, T, IsKeyCache, SharedWeakUnionPointer, SharedPointerType, Hash,
std::vector<key_type> v;
{
std::scoped_lock const lock(mutex_);
v.reserve(cache_.size());
// Keep track of how many iterations are needed. Exit the loop if the number of retries gets
// absurd. (Note that if this somehow ever happens, one more allocation will be done under
// lock, which is undesirable, but really should be almost impossible.)
std::size_t allocationIterations = 0;
std::unique_lock lock(mutex_);
for (auto size = cache_.size(); v.capacity() < size && allocationIterations < 20;
size = cache_.size())
{
ScopeUnlock const unlock(lock);
if (allocationIterations > 0)
{
JLOG(journal_.info())
<< "getKeys(): Cache grew beyond allocated capacity after "
<< allocationIterations << " prior attempt(s). Have " << v.capacity()
<< ", need " << size << ". Retrying allocation";
}
// Allocate the current size plus a little extra, in case the cache grows while
// allocating. Each time another allocation is needed, the extra also gets bigger until
// it ultimately doubles the size + 1.
constexpr std::size_t baseShift = 5;
auto const bufferOffset = std::min(allocationIterations, std::size_t{baseShift});
auto const bufferShift = baseShift - bufferOffset;
size += (size >> bufferShift) + 1;
v.reserve(size);
++allocationIterations;
}
if (v.capacity() < cache_.size())
{
// LCOV_EXCL_START
UNREACHABLE("xrpl::TaggedCache::getKeys(): failed to allocate sufficient capacity");
v.reserve(cache_.size());
// LCOV_EXCL_STOP
}
XRPL_ASSERT(lock.owns_lock(), "xrpl::TaggedCache::getKeys(): owns lock");
XRPL_ASSERT(
v.capacity() >= cache_.size(), "xrpl::TaggedCache::getKeys(): sufficient capacity");
for (auto const& _ : cache_)
v.push_back(_.first);
}

View File

@@ -41,6 +41,19 @@ public:
std::unique_ptr<NodeStore::Backend>&& newBackend,
std::function<void(std::string const& writableName, std::string const& archiveName)> const&
f) = 0;
/**
* Marks an online-delete rotation as in progress (or completed).
*
* While in flight, a read served by the archive backend is copied
* forward into the writable backend even for ordinary
* (duplicate == false) fetches: the archive is about to be deleted,
* and a node body canonicalized into caches during the rotation
* window would otherwise survive only in RAM once the archive is
* dropped.
*/
virtual void
setRotationInFlight(bool inFlight) = 0;
};
} // namespace xrpl::NodeStore

View File

@@ -9,6 +9,7 @@
#include <xrpl/nodestore/NodeObject.h>
#include <xrpl/nodestore/Scheduler.h>
#include <atomic>
#include <cstdint>
#include <functional>
#include <memory>
@@ -69,11 +70,22 @@ public:
void
sweep() override;
void
setRotationInFlight(bool inFlight) override;
private:
std::shared_ptr<Backend> writableBackend_;
std::shared_ptr<Backend> archiveBackend_;
mutable std::mutex mutex_;
// True between SHAMapStore starting the cache-freshen phase and the
// completion of rotate(). While true, archive hits on ordinary
// (duplicate == false) fetches are copied forward into the writable
// backend; copyForwardCount_ tallies them per rotation for the
// summary line logged at swap.
std::atomic<bool> rotationInFlight_{false};
std::atomic<std::uint64_t> copyForwardCount_{0};
std::shared_ptr<NodeObject>
fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate)
override;

View File

@@ -13,6 +13,7 @@
#include <xrpl/nodestore/Scheduler.h>
#include <xrpl/nodestore/Types.h>
#include <atomic>
#include <cstdint>
#include <exception>
#include <functional>
@@ -52,6 +53,7 @@ DatabaseRotatingImp::rotate(
// callback finishes. Only then will the archive directory be
// deleted.
std::shared_ptr<NodeStore::Backend> oldArchiveBackend;
std::uint64_t copyForwards = 0;
{
std::scoped_lock const lock(mutex_);
@@ -62,11 +64,28 @@ DatabaseRotatingImp::rotate(
newArchiveBackendName = archiveBackend_->getName();
writableBackend_ = std::move(newBackend);
copyForwards = copyForwardCount_.exchange(0, std::memory_order_relaxed);
}
if (copyForwards > 0)
{
JLOG(j_.warn()) << "Rotating: copied forward " << copyForwards
<< " archive-served reads into the writable backend "
"during the rotation window";
}
f(newWritableBackendName, newArchiveBackendName);
}
void
DatabaseRotatingImp::setRotationInFlight(bool inFlight)
{
rotationInFlight_.store(inFlight, std::memory_order_release);
JLOG(j_.debug()) << "Rotating: copy-forward on archive reads "
<< (inFlight ? "enabled" : "disabled");
}
std::string
DatabaseRotatingImp::getName() const
{
@@ -177,9 +196,18 @@ DatabaseRotatingImp::fetchNodeObject(
writable = writableBackend_;
}
// Update writable backend with data from the archive backend
if (duplicate)
// 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
// archive is about to be deleted, and a body canonicalized
// into the cache after the freshen getKeys() snapshot would
// otherwise survive only in RAM once the archive is dropped.
if (duplicate || rotationInFlight_.load(std::memory_order_acquire))
{
if (!duplicate)
copyForwardCount_.fetch_add(1, std::memory_order_relaxed);
writable->store(nodeObject);
}
}
}

View File

@@ -913,6 +913,10 @@ STObject::add(Serializer& s, WhichFields whichFields) const
XRPL_ASSERT(
(sType != STI_OBJECT) || (field->getFName().fieldType == STI_OBJECT),
"xrpl::STObject::add : valid field type");
XRPL_ASSERT(
getStyle(field->getFName()) != SoeDefault || !field->isDefault(),
"xrpl::STObject::add : non-default value");
field->addFieldID(s);
field->add(s);
if (sType == STI_ARRAY || sType == STI_OBJECT)

View File

@@ -16,9 +16,11 @@
#include <xrpl/ledger/Ledger.h>
#include <xrpl/nodestore/Database.h>
#include <xrpl/nodestore/Manager.h>
#include <xrpl/nodestore/NodeObject.h>
#include <xrpl/nodestore/Scheduler.h>
#include <xrpl/nodestore/detail/DatabaseRotatingImp.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/Serializer.h>
#include <xrpl/server/NetworkOPs.h>
#include <xrpl/server/State.h>
#include <xrpl/shamap/SHAMapMissingNode.h>
@@ -254,8 +256,24 @@ bool
SHAMapStoreImp::copyNode(std::uint64_t& nodeCount, SHAMapTreeNode const& node)
{
// Copy a single record from node to dbRotating_
dbRotating_->fetchNodeObject(
auto obj = dbRotating_->fetchNodeObject(
node.getHash().asUInt256(), 0, NodeStore::FetchType::Synchronous, true);
if (!obj)
{
XRPL_ASSERT(node.cowid() == 0, "SHAMapStoreImp::copyNode : rescued node must be clean");
// Reachable from the validated state map in memory, but present in
// neither backend: its only on-disk copy lived in a backend removed by
// an earlier rotation, and it was never rewritten because it is clean
// (cowid == 0, so flushDirty skips it). Persist the in-memory body
// directly into the writable backend so it survives this rotation
// instead of later surfacing as an unresolvable SHAMapMissingNode.
auto const hash = node.getHash().asUInt256();
Serializer s;
node.serializeWithPrefix(s);
dbRotating_->store(NodeObjectType::AccountNode, std::move(s.modData()), hash, 0);
JLOG(journal_.warn()) << "copyNode: re-stored node missing from both backends, hash="
<< hash << " type=" << static_cast<int>(node.getType());
}
if ((++nodeCount % checkHealthInterval_) == 0u)
{
if (healthWait() == HealthResult::Stopping)
@@ -348,6 +366,23 @@ SHAMapStoreImp::run()
JLOG(journal_.debug())
<< "copied ledger " << validatedSeq << " nodecount " << nodeCount;
// Close the getKeys()->swap exposure window: from here until
// rotate() completes, an ordinary read served by the archive is
// copied forward into the writable backend, so a node fetched
// from the doomed archive cannot be left RAM-only when the
// archive is deleted. RAII so the early returns below (and any
// exception) also clear the flag.
struct RotationExposureGuard
{
NodeStore::DatabaseRotating& db;
~RotationExposureGuard()
{
db.setRotationInFlight(false);
}
};
RotationExposureGuard const rotationExposureGuard{*dbRotating_};
dbRotating_->setRotationInFlight(true);
JLOG(journal_.debug()) << "freshening caches";
freshenCaches();
if (healthWait() == HealthResult::Stopping)