Repository navigation
fix: make writer-batching test deterministic under host load - #289
Merged
Merged
Conversation
|
Warning Review limit reachedYou'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 6 minutes. View limit details
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. |
- Queue the 64-write burst synchronously while a BEGIN IMMEDIATE holder blocks the writer, so every row is queued before the first commit and the burst lands in 1-2 batches by construction. - The old barrier-synchronized async burst let host load starve producers mid-burst, splitting it past the 16-batch bound (#240). - Test-only: production batching is untouched, so no changelog.
ryuzdev
force-pushed
the
fix/flake-240
branch
from
November 25, 2026 07:52
87d1c43 to
5ff995d
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
batch_loop(crates/cello/local_store.rs) drains with a blockingrecvfollowed by
try_recv: each commit holds exactly what had arrived whenthe writer woke, with no clock or gate coordinating the two sides. A
barrier-synchronized burst of 64 async PUTs usually arrives clustered
(1-4 batches), but when host load starves the PUT tasks mid-burst while
the unstopped writer keeps committing, one burst splits into more than
16 commits. The batch count is scheduler luck, so the test is flaky.
Fix (test-only, no production change)
The test now queues all 64 writes synchronously while a
BEGIN IMMEDIATEtransaction on a second connection holds the databasewrite lock. The writer parks in its own
BEGIN IMMEDIATE(30s busytimeout) and cannot commit until the test COMMITs the holder after the
64th send, so at most one partial head plus the rest commit: 1-2 batches
by construction, against the unchanged
1..=16bound (8x margin).Concurrent PUT fan-in stays covered by
concurrent_conditional_puts_stay_correct. Splitting under load wasnever a correctness bug (every row still lands), so per the 0.3.1 slice
rules this test-only fix adds no changelog entry.
Fail-before / after evidence
targeted runs plus 55 loaded full-suite runs (taskset 0-3/0-1, 28 CPU
hogs pinned and unpinned) showed 0 failures either way.
arrivals 1ms apart with no lock held committed 62-64 batches and
failed the bound 3/3; it isolates arrival timing as the variable the
fix controls (deleted before commit).
batches exactly 1-2 (17x one batch, 13x two). The 25 harsh full-suite
runs above also each ran the rewritten test green.
cargo test -p cello, workerdiff gate (297 cases agree),check-docs.
Closes #240