Return NOT_FOUND for missing tables and streams in the Storage Write API - #506
Open
laughingman7743 wants to merge 1 commit into
Open
Return NOT_FOUND for missing tables and streams in the Storage Write API#506laughingman7743 wants to merge 1 commit into
laughingman7743 wants to merge 1 commit into
Conversation
A Storage Write API RPC naming a table that does not exist surfaced as codes.Unknown, because the handlers returned plain errors carrying no gRPC status. Clients implementing create-if-needed logic key on NOT_FOUND to decide to create the table; Unknown reads as a transient failure and gets retried instead. getTableMetadata now returns status-carrying NotFound errors for a missing project, dataset or table (CreateReadSession shares the helper and benefits unchanged), the stream lookups in getOrCreateWriteStreamStatus, FlushRows and FinalizeWriteStream answer NotFound for a stream that does not exist, and GetWriteStream propagates the underlying error with %w instead of replacing it, so a missing table behind a _default stream name surfaces as NOT_FOUND too. BatchCommitWriteStreams already reports missing streams in-band as StorageError.STREAM_NOT_FOUND and is untouched, as is the streaming AppendRows error protocol. Fixes goccy#504
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.
Summary
getTableMetadatareturns gRPC-statusedNotFounderrors for a missing project/dataset/table, soCreateWriteStream(andCreateReadSession, which shares the helper) answerNOT_FOUNDinstead ofUNKNOWNNOT_FOUNDfor a stream that does not exist:getOrCreateWriteStreamStatusand theFlushRows/FinalizeWriteStreamlookups return statused errors, andGetWriteStreampropagates the underlying error with%winstead of replacing it — so a missing table behind a_defaultstream name also surfaces asNOT_FOUNDBatchCommitWriteStreamsis untouched: it already reports missing streams in-band asStorageError.STREAM_NOT_FOUND, and the streamingAppendRowserror protocol is left as isClients implementing create-if-needed logic key on
NOT_FOUNDto decide to create the table;UNKNOWNreads as a transient failure, so such clients retried until their budget was exhausted and never created the table.Fixes #504
Tests
go test ./server -run "TestStorageWriteMissingTableReturnsNotFound" -count=1 -v(new; red on main for all three subtests, green with this change — asserts through a real gRPC transport, so the%w-wrapped statuses are verified to survivestatus.FromError)go test ./server -run "TestStorageWrite|TestDefaultWriteStream|TestStorageReadAVRO|TestStorageReadARROW|TestCreateReadSession|TestIssue382" -count=1go test ./server