Skip to content

feat(storage): add ObjectTooLargeError and map it to EFBIG - #5193

Open
PranjalC100 wants to merge 4 commits into
masterfrom
mpu/efbig-error
Open

PranjalC100 wants to merge 4 commits into
masterfrom
mpu/efbig-error

Conversation

@PranjalC100

@PranjalC100 PranjalC100 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Description

Error handling for the parallel upload work (b/548851494), split out so it can be reviewed on its own. It doesn't depend on the other parallel upload PRs.

  1. gcs.ObjectTooLargeError (internal/storage/gcs/errors.go): a generic error for an object that exceeds the maximum size supported by the upload strategy.
  2. gcs.GetParallelUploadError(err): converts an InvalidArgument error into *ObjectTooLargeError. nil, other errors, and an existing *ObjectTooLargeError are returned unchanged. Use it only for parallel uploads, because InvalidArgument means other things elsewhere.
  3. internal/fs/wrappers/error_mapping.go: *gcs.ObjectTooLargeError → EFBIG instead of the default EIO. The fs error metrics already count EFBIG.

Nothing returns the new error yet. A later PR calls GetParallelUploadError on writer.Write, CreateObject and FinalizeUpload errors, in Parallel write mode only.

Link to the issue in case of a bug fix.

b/577926767

Testing details

  1. Manual - NA
  2. Unit tests - go test -race ./internal/storage/gcs/... ./internal/fs/wrappers/...: new TestGetParallelUploadError (6 cases), TestObjectTooLargeError_UnwrapsCause, and TestWithErrorMapping/TestObjectTooLargeError.
  3. Integration tests - NA (no caller yet)

Any backward incompatible change? If so, please explain.

No. Nothing returns the new error yet.

gRPC parallel uploads reject writes beyond the maximum number of
segments of an object with InvalidArgument. gcs.GetParallelUploadError
returns that error as a new *gcs.ObjectTooLargeError, and the fs error
mapping turns it into EFBIG instead of the default EIO.

Nothing returns the error yet. The parallel upload writers will convert
their errors with GetParallelUploadError, in Parallel write mode only.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new ObjectTooLargeError to represent parallel upload failures when the maximum number of segments is exceeded, mapping it to syscall.EFBIG in the filesystem error wrapper. It also adds corresponding unit tests for the new error and its mapping. The review feedback suggests using status.FromError in GetParallelUploadError for consistency with other error-handling functions in the package when extracting gRPC status codes.

Comment thread internal/storage/gcs/errors.go Resolved
@PranjalC100 PranjalC100 added execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. labels Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.11%. Comparing base (57e2043) to head (af01fb9).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5193      +/-   ##
==========================================
+ Coverage   85.09%   85.11%   +0.01%     
==========================================
  Files         179      179              
  Lines       19776    19787      +11     
==========================================
+ Hits        16828    16841      +13     
+ Misses       2947     2945       -2     
  Partials        1        1              
Flag Coverage Δ
unittests 85.11% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@PranjalC100
PranjalC100 marked this pull request as ready for review October 26, 2026 16:11
@PranjalC100
PranjalC100 requested a review from a team as a code owner October 26, 2026 16:11
@github-actions github-actions Bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Oct 26, 2026
@PranjalC100
PranjalC100 requested review from vipnydav and removed request for kislaykishore October 26, 2026 16:11
Comment thread internal/storage/gcs/errors.go Resolved
Comment thread internal/storage/gcs/errors.go Resolved
Comment thread internal/fs/wrappers/error_mapping.go Resolved
Address review feedback on the ObjectTooLargeError and
GetParallelUploadError doc comments.
@PranjalC100
PranjalC100 requested a review from vipnydav October 27, 2026 10:11
Comment thread internal/storage/gcs/errors.go Resolved
InvalidArgument can be returned for other reasons as well. Track
narrowing the check in GetParallelUploadError once the error for an
object that is too large is known.

@vipnydav vipnydav left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if err == nil || errors.As(err, &objectTooLargeErr) {
return err
}
// TODO(b/578761925): InvalidArgument can be returned for other reasons as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure why we are adding this before the server errror is finalized. if we forget to do it or there is a delay in server implementation we would end up converting all invalid arguments to objectTooLarge error whereas the viceversa is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.

3 participants