-
Notifications
You must be signed in to change notification settings - Fork 16
fix: shard overload handle #2895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes handling of shard overload errors in the streaming API by adding proper error chunk detection and handling. The fix prevents error responses from being processed as regular streaming chunks, which could cause issues when the server returns error responses due to shard overload conditions.
- Adds a new
isErrorChunk
utility function to detect error responses in streaming data - Updates streaming API to check for and throw error chunks before processing as regular streaming chunks
- Refactors chunk processing logic to improve error handling flow
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/store/reducers/query/utils.ts | Adds isErrorChunk type guard function and imports ErrorResponse type |
src/services/api/streaming.ts | Updates streaming parser to detect and handle error chunks, refactors chunk processing logic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 comment
@Raubzeug added explicit request cancellation |
Closes #2894
Stand
Greptile Summary
Updated On: 2025-09-17 17:56:56 UTC
This PR introduces proper error handling for streaming queries in the YDB Embedded UI by adding error chunk detection functionality. The change addresses issue #2894 related to shard overload handling by adding an
isErrorChunk
utility function that identifies error responses in streaming data and modifying the streaming API to handle these error chunks appropriately.The implementation adds a type guard function
isErrorChunk
insrc/store/reducers/query/utils.ts
that detects whether a streaming chunk contains error information by checking for the presence of 'error' or 'issues' properties. This function is then utilized insrc/services/api/streaming.ts
to identify error chunks early in the parsing pipeline and throw them as exceptions before attempting to process them as regular streaming chunks.The solution fits well within the existing streaming architecture by adding a safety layer that prevents error responses from being misprocessed as regular streaming data. This is particularly important because error responses have a different structure than expected streaming chunks (which contain meta.event properties), and attempting to process them as such would cause runtime errors.
Important Files Changed
Changed Files
isErrorChunk
utility function to detect error responses in streaming chunksConfidence score: 4/5
Context used:
Style Guide - description of repository for agents (link)
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 85.49 MB | Main: 85.49 MB
Diff: +1.07 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information