Repository navigation
test(store): a settled cross-shard read's budget waits for the reads it cut off - #2379
Merged
Merged
Conversation
…it cut off Claim and CallResources.Select return once one shard's answer settles them and do not wait for the other shards' reads (#2256). Their query budgets counted straight after the call returned, so the cut-off read was sometimes not in yet (1 for 2) and then landed in the next count (3 for 2). The budget now waits, up to a deadline, for one statement from every shard before it counts.
…ts-wait-for-cut-off-reads
thesyncim
marked this pull request as ready for review
November 24, 2026 13:15
martinmitrevski
approved these changes
Nov 24, 2026
martinmitrevski
left a comment
Collaborator
There was a problem hiding this comment.
No findings at a48efe8.
Checked and sound:
answeringShardsruns one statement per shard. bun callsafterQueryeven when the context is cancelled, so a read the answer cut off is still counted.- Waiting for one statement per shard therefore keeps the exact
Equalstrict. An extra statement still fails it, and a missing shard read fails at the deadline. PinuseseveryShard, so nothing from theSelectcount spills into it.
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.
Problem
CallBridges.ClaimandCallResources.Selectread every shard at once and return as soon as one shard's answer settles the read; the other shards' reads are cancelled and not waited for (answeringShards, #2256).TestABridgeIsClaimedOnceFromAnyShardAndSweptOnceExpiredandTestCallResourceQueryBudgetscounted statements straight after the call returned, so in the sharded suite the cut-off read was sometimes not counted yet (1 for 2), and then landed in the next count (Pin, 3 for 2). Main's store job went red on it.Fix
countSettledReads, which waits, up to a deadline, until a statement from every shard is in, then counts. No assertion changes: each still expects one statement a shard.answeringShardsfor the cancelled reads was tried and brings back the stall AI-3506: one unreachable shard no longer stops sessions and bridges on the others #2256 removed: pgdriver lets go of a read on a host that accepts and never answers only at its deadline, not on cancel, andTestACallPlacedOnAShardThatAnswersIsFoundWithoutWaitingOnOneThatDoesNotfailed with it (2.0s against a 2s bound).Tests
-count=30of the two tests in the sharded suite failed in at least five runs (the kept output does not hold the full count):Selectexpected 2, got 1, followed byPinexpected 2, got 3, andClaim asks every shard onceexpected 2, got 1. With the change,-count=30of both tests in both store suites passed.answeringShardsfails both budgets ("a statement from every shard" never satisfied).