Files
rippled/docker/telemetry
Pratik Mankawde df01ba5d3d fix(ledger): stop the sweeper deleting acquires that are still being served
Two metric-level defects the sync analysis identified, fixed at the source rather
than worked around on the dashboard.

1. InboundLedgers::sweep() destroys any acquire idle for more than a minute, and
   that destruction is what telemetry reports as outcome=abandoned. But
   lastAction_ was only refreshed by the constructor, update() and done() --
   never by the receive path. With JtLedgerData capped at 3 concurrent jobs and
   33 acquires in flight, an acquire whose peers were answering normally could
   wait past the cutoff for its turn to apply data and be deleted for looking
   idle. Measured on a fresh mainnet sync: 490 abandoned acquires against ZERO
   expired retry budgets, so every one was a sweep, not a give-up.

   gotData() now calls touch(). The sweeper's idle test measures real inactivity
   instead of queue wait.

   lastAction_ had to become atomic to allow this. It was a plain
   clock_type::time_point written by the acquiring thread and read by sweep() on
   the timer thread; adding a third writer on peer threads would have been a data
   race. It is now std::atomic<clock_type::duration::rep> with relaxed ordering on
   both sides -- the sweeper compares against a 60-second threshold, so a value
   one tick stale cannot change its decision.

2. getLedgersBehindNetwork() returned the entire ledger sequence space on a fresh
   node. The existing floor only guarded being ahead of every peer; it did not
   guard having validated nothing at all, so validated=0 against a live tip gave
   105,892,534 -- an accurate subtraction of a meaningless quantity. It
   auto-scaled every consumer's axis and would trip any threshold. Distance to
   tip is undefined before the first validated ledger, so it now reports 0 until
   there is one, and the sync-state signals carry the initial-acquire progress.

   The clamp_max(1e6) added to the Ledgers Behind Network panel as a stopgap is
   removed: the metric is correct now, and leaving the clamp would hide a real
   large backlog.

Verified: clang-tidy over the full compile database reports no finding on any
changed line in the three files (the pre-existing misc-include-cleaner and
misc-const-correctness findings elsewhere in InboundLedger.cpp are untouched by
this change). pre-commit passes including clang-format and the Doxygen style
check; validate_dashboards passes.

Not verified: not compiled -- per instructions.md the build needs approval, so CI
is the first real compile of the atomic change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 14:30:08 +01:00
..
2026-07-09 14:27:02 +01:00