Skip to content

csnode: a confidant defers the backfill flush - #147

Merged
EnzinoBB merged 1 commit into
masterfrom
fix/backfill-flush-trusted
Oct 31, 2026
Merged

EnzinoBB merged 1 commit into
masterfrom
fix/backfill-flush-trusted

Conversation

@EnzinoBB

Copy link
Copy Markdown
Collaborator

Why

The mainnet test node (full rocksdb from the snapshot, master 8d4bc38) logs each backfill flush with its duration (#140): 69 flushes, median 358 ms, p90 808 ms, max 2398 ms, 6 over 1 s, every ~10,000 blocks (~25 s). The flush runs on the processor thread, outside the turn budget, so on a confidant it can hold consensus for more than a round.

Change

flushIfDue: while the node is a confidant (Context::trusted, #146) a due flush waits for the first turn outside the trusted set, at most kTrustedFlushDeferMs (10 min) after the last one. A forced flush (end of the backfill, stop) is unchanged. Blocks not flushed yet are fetched again after a crash: the next start resumes from the flushed floor (seen on mainnet today).

Limit: a flush started outside the trusted set can still run into a round where the node is trusted; moving the flush to its own thread is a larger change, left for later.

Test AConfidantDefersTheFlush.

Test plan

  • CI build and unit tests (Linux, Windows, macOS)
  • robustness backfill rows
  • mainnet test node

🤖 Generated with Claude Code

On the mainnet test node the backfill flush (transaction index, block
hashes, storage) took 358 ms at the median and up to 2.4 s, on the
processor thread, every ~25 s. While the node is a confidant it now
waits for the first turn outside the trusted set, 10 minutes at most;
blocks not flushed yet are fetched again after a crash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnzinoBB
EnzinoBB merged commit e422d2f into master Oct 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant