Skip to content

fix: hand a bundle round's uncaptured cells back to the per-cell path (#243) - #244

Merged
ryuzdev merged 1 commit into
mainfrom
fix/bundle-capture-fallback
Nov 24, 2026
Merged

ryuzdev merged 1 commit into
mainfrom
fix/bundle-capture-fallback

Conversation

@ryuzdev

@ryuzdev ryuzdev commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

The stall

Inside a bundle round, a capture can refuse: db.sync() errors, db.pos()
errors, or a staged-row read_ltx_file errors. The cell was then dropped with
bucket_bundling() still armed, and sync_loop uploads nothing per cell while
bundling is armed — bundling was dropped only on a put_bundle failure or a
failed lone-cell sync_cell. So with no later write, that durability ticket
waited out its whole CELLO_LTX_DURABILITY_TIMEOUT_SECS budget with zero
PUTs
, and the cell reset. Same class as #200, different trigger.

The fix (round 2, after review)

The round reports an incomplete capture, and order matters:

  1. Flush and credit first. The cells the round did capture ride their
    bundle PUT and are credited.
  2. Then hand the failed cell back, by calling
    note_bucket_bundle_stalled() after the if flushed_ok { … } block. That
    drops the epoch so sync_loop re-spawns a per-cell worker that retries with
    its existing 50 ms backoff.
  3. The credits.is_empty() early-continue path also notes the stall, because
    there is no flush to protect there.

Round 1 noted the stall before the flush. That clears bucket_epoch, and
put_bundle refuses a bucket flush without a live epoch, so the whole round
issued no PUT and the healthy cells' captured rows were discarded — nobody was
credited. This was the P2 from review; the ordering is the fix.

No duplicate rows. A failed cell's rows are now staged into a per-cell
Vec inside the capture and extended into entries only when the capture is
complete, so the failed cell contributes nothing to the bundle. Its per-cell
retry uploads each row exactly once; a restore sees each row either as a
per-cell object or as a bundle row, never twice. Entries are otherwise identical
to before, which the existing bundle_loop_shares_one_bundle_between_two_cells
case confirms (one shared bundle, no per-cell PUTs).

A closed replica is not a failure: managed_db_mut returning None means
the cell is leaving and has no credit path at all, so it stays a silent skip.

No timeout bump, no sleep, no retry loop added.

Fail-before and the test

node_log::bucket_executor_tests::a_failed_bundle_capture_flushes_its_healthy_cells_first
is deterministic: both tickets are taken in one call
(bump_durability_tickets_for_test) under the cell map's lock, which the
loop's dirty snapshot also takes, so a round can never observe half the round's
tickets and always sees two dirty cells and the shared bundle path. A one-shot
#[cfg(test)] seam fails c0's capture, and the test awaits c0's own held
ticket
(await_durability_ticket_for_test) so the retry sees a single pending
write and takes the per-cell path instead of a fresh ticket that would turn it
into a one-cell bundle.

Assertions, all non-timing:

  • exactly one bundle PUT under log/n0/gen1/bundle/ — the healthy cell's rows
    ride it, so the flush preceded the stall;
  • the per-cell prefix holds at least one object and every key names c0 —
    the healthy cell was credited by the bundle, the failed one by the per-cell
    retry;
  • c0's held ticket credits with ProofSource::Bucket;
  • the fallback fired (wait_for_bundle_stalls).

Fail-before, on the reviewed ordering (stall noted before the flush):
panicked at the failed cell uploads through the per-cell path. With the fix:
3/3 runs green in 0.01 s.

Checks

  • cargo test --profile ci --locked -p cello --no-fail-fast: 0
    test result: FAILED lines (lib 629 passed, main 43, every conformance
    binary). The other bundle cases
    (bundle_loop_shares_one_bundle_between_two_cells,
    lone_cell_per_cell_failure_heals_through_retry,
    a_posture_wake_is_spent_on_the_round_it_enables) pass.
  • cargo clippy --profile ci --locked --all-targets -- -D warnings: clean.
  • cargo fmt --check: clean. node scripts/check-docs.mjs: clean.
  • Changelog ## Unreleased bullet updated with the flush-then-fallback
    ordering and the no-duplicate-rows property.
  • docs/reference/cloudflare-compat.md untouched: no workerd surface change.

Closes #243

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ce134c5-f1c7-4cc7-8657-94550777d946
Commits

Reviewing files that changed from the base of the PR and between 551809b and feda53b.

Files selected for processing: 3

  • crates/cello/ltx_repl.rs
  • crates/cello/node_log.rs
  • docs/changelog.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

- A capture that refuses (`db.sync()`, `pos()`, a staged-row read) left
  its cell uncredited while `bucket_bundling()` stayed armed, and
  `sync_loop` uploads nothing per cell while bundling is armed, so that
  durability ticket waited out its whole budget with zero PUTs until
  another write arrived (#243).
- The round now reports the incomplete capture, flushes and credits the
  cells it did capture, and only then drops bundling so the scan's
  worker retries the failed cell per cell with backoff. Dropping it
  first would clear the epoch, and `put_bundle` refuses a bucket flush
  without one: the healthy cells' rows would be discarded and nobody
  credited (#244 review).
- A failed cell's rows are staged per cell and never extended into the
  bundle, so the per-cell retry uploads each row exactly once. A closed
  replica stays a silent skip: that cell has no credit path.
- a_failed_bundle_capture_flushes_its_healthy_cells_first pins the whole
  contract deterministically: two tickets land under the cell map's lock
  so the round always sees both cells, a one-shot seam fails c0's
  capture, and the test asserts one bundle PUT with c1 credited by it
  and c0 credited by its own per-cell retry. Fail-before (stall noted
  before the flush) panics at the per-cell assertion.
@ryuzdev
ryuzdev force-pushed the fix/bundle-capture-fallback branch from 2878d7f to feda53b Compare November 24, 2026 09:37
@ryuzdev
ryuzdev merged commit 61d8f60 into main Nov 24, 2026
9 checks passed
@ryuzdev
ryuzdev deleted the fix/bundle-capture-fallback branch November 24, 2026 09:57
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.

durability: a failed capture inside a bundle round leaves the cell uncredited while bundling stays armed (zero-PUT stall)

1 participant