Skip to content

fix(raft): a no-op on a ledger with no commit completes, and full novelty waits for a build - #2488

Open
bplatz wants to merge 4 commits into
test/raft-v4-golden-fixturefrom
fix/raft-noop-unborn-novelty-wait
Open

bplatz wants to merge 4 commits into
test/raft-v4-golden-fixturefrom
fix/raft-noop-unborn-novelty-wait

Conversation

@bplatz

@bplatz bplatz commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2485, whose v4 fixtures this change is checked against.

A no-op on a ledger with no commit (#2465)

On a cluster, a transaction that changes nothing completes its queue entry by republishing the branch's head. A ledger created with no commit has no head, so the entry was poisoned as WorkerPanic. A standalone server answers the same transaction with a receipt at t 0.

The worker now completes it with a new command, CompleteNoOp. The command pops the entry, records the no-op receipt (CommitReceipt::no_op, t 0, no flakes) under its idempotency key, and leaves the branch with no head. If the branch has gained a head since the worker staged, the entry goes back to the front and is staged again, as for any lagging view.

A follower's worker sends the completion to the leader over a new route, POST /raft/apply_queue_no_op, rather than through apply_staged_commit. A leader from before this change would turn a staged commit into an ApplyHead, which would give the branch the sentinel id as its head. A route that leader lacks answers 404 instead, and the worker retries until the leader is upgraded.

Novelty backpressure on a cluster (#1741)

A worker that found novelty full treated it as transient: three attempts over 300 ms, then the entry was poisoned. It answered 422, and a failure was recorded under the key that no retry could clear once novelty drained. A delta too large for novelty answered 422 BodyMalformed.

  • Drainable (NoveltyAtMax, or NoveltyWouldExceed with room once novelty drains): the entry waits at the front of its queue with backoff, up to 2 s per wait. It refreshes its view and re-stages once a build drains novelty, the way it already waits on a lagging view. No write guard is held while it waits. The client stays parked under the existing 10-minute ceiling, and a full queue turns new submissions away with 503.
  • Too large (the delta alone reaches the ceiling): poisoned with a new PoisonReason::NoveltyDeltaTooLarge and answered 413 + err:db/NoveltyDeltaTooLarge, as on a standalone server.

The local path and the worker now share one rule (novelty_refusal) for telling the two apart.

A write on a ledger from 4.2 during the upgrade

A three-node run of this branch, upgrading a 4.2.9 cluster follower by follower as documented, found a failure that next already had. Under the 4.2 leader, an upgraded follower cannot resolve the ledgers 4.2 created, because only a leader of this release binds them to their names. A write whose branch that follower owned failed to load its ledger and was poisoned as StagingFailed (422). The failure was recorded under the request's key, so a retry still failed after the upgrade finished.

The worker now waits at the front of the queue, as for full novelty, when the replicated state lists the branch with no binding, no fence and no drop, under a name the binding accepts. The first leader of this release binds the ledger, and the write commits. A ledger it cannot load for any other reason still fails as before.

Replicated format

Command::CompleteNoOp and PoisonReason::NoveltyDeltaTooLarge are appended variants, pinned at positions 36 and 6 by a test. This release reads older logs and snapshots, but an older node cannot read the new entries. The rolling-upgrade docs say so, beside the name bindings that already need the upgrade finished. The v4 fixtures from #2485 still decode, still answer v4's cached WorkerPanic, and now also complete a new no-op on the ledger v4 created with no commit.

Tests

  • State machine: a no-op completes with no head; it goes back to the front when the branch has a head; a keyless no-op releases its envelope; the variant positions.
  • Embedded node:
    • A no-op on a ledger with no commit returns t 0, again on a keyed retry, and the first write afterwards lands at t 1.
    • A write that finds novelty full waits through a build held back for a second and then commits, and its retry returns the receipt. A delta twice the ceiling is answered NoveltyDeltaTooLarge.
    • Undoing each fix fails its test with the issue's symptom: WorkerPanic, StagingFailed { attempts: 3 } (422) and BodyMalformed (422).
  • Worker: a ledger awaiting its binding waits; a fenced, bound or dropped ledger, or one under a refused name, still fails. Undoing the fix fails the test with the 422's "Ledger not found".
  • Three-node server cluster:
    • A no-op on a branch a follower owns completes through the leader. Pointing the ferry at a missing route makes it time out, so the test does go through the new route.
    • Writes on a branch a follower owns wait while the leader's indexer drains novelty, and all commit.

Docs

  • raft-clusters.md: the submission flow covers no-op completion, novelty waits, and retrying by key after a 502 when the leader restarts. The rolling-upgrade section covers the new route, the 413 an older leader cannot decode, and what an upgraded follower does before the ledgers are bound.
  • upgrading-from-4.2.md: until the first upgraded leader binds the ledgers, an upgraded follower answers 404 to queries for them and holds their writes.
  • configuration.md: the --reindex-max-bytes description covers cluster behavior and the 413.
  • raft-command-queue.md: lists CompleteNoOp.

Fixes #2465
Fixes #1741

…elty waits for a build

A transaction that changed nothing on a ledger created with no commit was
poisoned as WorkerPanic: the worker completes a no-op by republishing the
branch head, and such a branch has none. It now completes through
Command::CompleteNoOp, which pops the entry and records the no-op receipt
at t 0 (the receipt the same transaction gets outside a cluster), leaving
the branch without a head. A follower's worker ferries it to the leader
over a route of its own, apply_queue_no_op: a leader from before it answers
404 and the entry waits, where an ApplyHead would give the branch a head.

A worker that found novelty full retried three times over 300 ms and then
poisoned the entry, recording a failure under its key that no retry could
clear once novelty drained. It now waits at the queue front and re-stages
once an index build makes room, as it does for a lagging view. A
transaction whose own novelty reaches the ceiling is poisoned with
PoisonReason::NoveltyDeltaTooLarge and answered 413 +
err:db/NoveltyDeltaTooLarge, as outside a cluster, instead of 422. The
local and worker paths share one rule for telling the two apart.

Both variants are appended, so this release reads older logs and snapshots;
an older node cannot read the new entries. The v4 fixtures now also
complete a no-op on the ledger v4 created with no commit.
@bplatz bplatz added the bug Something isn't working as expected label Nov 22, 2026
@bplatz
bplatz changed the base branch from next to test/raft-v4-golden-fixture November 22, 2026 19:58
@bplatz
bplatz added this pull request to stack #2489 November 22, 2026 19:58
Under a leader of an earlier release, an upgraded follower cannot resolve
a ledger from before name bindings: only a leader of this release binds
it. A write whose branch that follower owned failed to load the ledger,
and its failure was recorded under the request's key, so a retry kept
failing after the upgrade finished.

The worker now waits at the queue front, as for full novelty, when the
replicated state lists the branch with no binding, no fence and no drop,
under a name the binding accepts. The docs say the follower answers 404
to queries for those ledgers until then.
@bplatz
bplatz requested a review from a team November 23, 2026 18:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant