Skip to content

rollback: build the delta while the merkle update runs - #952

Merged
rphmeier merged 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/rollback-delta-during-merkle-update
Oct 26, 2026
Merged

rphmeier merged 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/rollback-delta-during-merkle-update

Conversation

@citizen-stig

@citizen-stig citizen-stig commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

With rollback enabled, Session::finish calls ReverseDeltaBuilder::finalize before it starts the merkle update. finalize waits for the speculative prior-value loads and fetches the priors of any written keys that weren't preserved in advance. All of that happens before any merkle work begins.

Changes

  • finalize now runs after update_and_prove has been kicked off, so the delta is built while the merkle workers run.

This is safe because both sides only read: the merkle update reads pages and leaves, and the delta worker reads values through its own beatree read transaction (rollback/reverse_delta_worker.rs). The store isn't modified until the FinishedSession is committed, and a sync waits for open read transactions. The resulting delta is the same.

Unrelated to #947, which moves where the delta is persisted (inside the store sync). This PR changes when it is built (during Session::finish).

Touches the same lines of Session::finish as #951. Whichever lands second needs a trivial rebase.

Performance impact

after benchmarking from #944 (rollback enabled, e.g. NOMT_BENCH_ROLLBACK=<len>).

With rollback enabled (NOMT_BENCH_ROLLBACK=100, transfer workload, 16 paired rounds on a dedicated NVMe), Session::finish drops from 92.1 ms to 71.4 ms (−22.6%), mean block time drops by 11.2%, and throughput rises by 13% (63.7k → 72.5k ops/s). With an overlay window of 4, the gains are similar: finish −26.8% and block time −12.9%. This removes almost all of rollback's cost from finish, which now matches the rollback-disabled time of 73.5 ms. With rollback disabled the change is a no-op, and the durable commit time is unaffected.

Combined with #947 (rollback delta persisted inside the store sync), the durable commit also drops by 13.6%, so mean block time falls by 17.6% and throughput rises by 21.7% (63.9k → 75.8k ops/s) compared with master.


  ┌────-──────┬─────────────┬─────────────────────┬───────────────────────────┬────────────────────────────┐
  │  vs base  │   finish    │ durable_commit mean │     Block time, mean      │      Block time, p50       │
  ├───-───────┼─────────────┼─────────────────────┼───────────────────────────┼────────────────────────────┤
  │  952 only │ −22.9%, 4/4 │ +0.7% (CI ±37)      │ −11.0% (CI ±16)           │ −7.9% (CI ±23)             │
  ├─────────-─┼─────────────┼─────────────────────┼───────────────────────────┼────────────────────────────┤
  │ 952 + 947 │ −23.6%, 4/4 │ −14.0% (CI ±19)     │ −18.0% [−26.6, −9.4], 4/4 │ −17.7% [−18.7, −16.7], 4/4 │
  └─────────-─┴─────────────┴─────────────────────┴───────────────────────────┴────────────────────────────┘

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@citizen-stig
citizen-stig force-pushed the nikolai/rollback-delta-during-merkle-update branch from fc91b25 to 47296c8 Compare October 26, 2026 13:34
@citizen-stig
citizen-stig marked this pull request as ready for review October 26, 2026 15:26
@rphmeier
rphmeier merged commit d690a36 into thrumdev:master Oct 26, 2026
7 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.

2 participants