Let a client retry a cursor this instance cannot resolve - #212
Merged
Conversation
Mapping the failure to InvalidArgument had clients discard a cursor another instance may well resolve, and the SQL sink exit on it.
Contributor
Author
sduchesneau
marked this pull request as ready for review
August 17, 2026 19:27
maoueh
approved these changes
Aug 17, 2026
maoueh
left a comment
Contributor
There was a problem hiding this comment.
Do we want to add a e2e test for it?
UlysseCorbeil
approved these changes
Aug 17, 2026
Contributor
Author
no, that part is not important enough, the bstream unit tests are good enough for me. |
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.
What
firehose/server/blocks.gomaps*stream.ErrUnavailabletocodes.Unavailable, ahead of the existing*stream.ErrInvalidArg→codes.InvalidArgumentbranch.bstream#63 returns that type for one case: the cursor names a block above the live head that did not arrive within
CursorHeadWaitTimeout(5s). Nothing about it says the cursor is wrong — this instance may simply be lagging while another one already serves that block, which is what a client reconnecting to a fleet member a few blocks behind looks like.InvalidArgumentwould have that client throw away a good cursor; in the SQL sink it is one of four fatal codes (sink/sinker.go), so the process exits.A cursor no source can resolve keeps its
InvalidArgumentmapping (firehose cannot handle that, even if substreams can)Without this change the error falls to the default branch and reaches clients as
Internalwith the message replaced by "unexpected stream termination" — retryable in practice, unreadable in a log.Measured
Against
devel/standard(dummy chain), forging a cursor 500 blocks above head:Internalcode = Unavailable, which the substreams sink logs as a retryable error