Skip to content

fix(storage): respect maxAttempts parameter in HTTP OpenWriter - #20153

Open
sahusneha2004 wants to merge 1 commit into
googleapis:mainfrom
sahusneha2004:fix-http-writer-max-attempts
Open

fix(storage): respect maxAttempts parameter in HTTP OpenWriter#20153
sahusneha2004 wants to merge 1 commit into
googleapis:mainfrom
sahusneha2004:fix-http-writer-max-attempts

Conversation

@sahusneha2004

Copy link
Copy Markdown
  • Updates OpenWriter in http_client.go to track retry attempt counts and respect s.retry.maxAttempts.
  • Formats error as 'storage: retry failed after N attempts; last error: ...' upon exceeding max attempts.
  • Adds TestRetryConformance_MaxAttempts in retry_conformance_test.go to validate max_attempts behavior dynamically against retry_tests.json for both HTTP and gRPC transports.

@sahusneha2004
sahusneha2004 requested review from a team as code owners July 14, 2026 09:31
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 14, 2026

@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 implements and tests maximum retry attempt limits for the storage client. Specifically, in storage/http_client.go, the OpenWriter method is updated to track retry attempts and enforce maxAttempts limits, wrapping the final error when the maximum attempts are exceeded. Additionally, new unit tests and conformance tests are added in storage/client_test.go and storage/retry_conformance_test.go to verify this behavior for both HTTP and gRPC transports. There are no review comments to address, and I have no additional feedback to provide.

@sahusneha2004
sahusneha2004 force-pushed the fix-http-writer-max-attempts branch 2 times, most recently from cda8809 to 75904de Compare July 15, 2026 08:42
In http_client.go, pass a unified retryFunc callback into call.WithRetry to enforce storage.ShouldRetry fallback and safely handle nil retry configs.

In client_test.go, set googleapi.DefaultUploadChunkSize on openWriterParams in TestWriterRetryMaxAttemptsEmulated so media chunk buffering enables HTTP retries, and capture synchronous pw.Close() error propagation to correctly assert max attempt errors.
@sahusneha2004
sahusneha2004 force-pushed the fix-http-writer-max-attempts branch from 75904de to b43ff8a Compare July 15, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant