Skip to content

fix(storage): Implement clean half-close stream teardown for appendable uploads#16112

Open
kalragauri wants to merge 2 commits into
googleapis:mainfrom
kalragauri:feature/appendable-close
Open

fix(storage): Implement clean half-close stream teardown for appendable uploads#16112
kalragauri wants to merge 2 commits into
googleapis:mainfrom
kalragauri:feature/appendable-close

Conversation

@kalragauri
Copy link
Copy Markdown
Contributor

Currently, closing an active write stream triggers a standard Flush() and cancels the stream. By using a clean half-close, the client abandons the write side cleanly, allowing GCS to persist all outstanding data.

This first PR introduces the core API interface, and the base stream close implementation. Subclass decorators (such as the Buffered, Resumed, and Tracing connections) are configured with a default fallback to standard Flush() to keep this PR small and safe. Follow-up PRs will customize the implementation under these sub-classes.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label May 25, 2026
Copy link
Copy Markdown

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

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 Close method to the AsyncWriterConnection interface and its implementation, allowing for a clean flush of pending data followed by a stream half-close. The changes update the PartialUpload state machine to support a new kFlushAndClose action and include comprehensive unit tests. Feedback indicates that the Close() implementation in AsyncWriterConnectionImpl might return a satisfied future before the underlying gRPC Finish() call completes, which could lead to missed errors or incomplete teardowns.

Comment thread google/cloud/storage/internal/async/writer_connection_impl.cc
@kalragauri kalragauri force-pushed the feature/appendable-close branch from 64b44c1 to 9e71403 Compare May 25, 2026 07:26
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 95.34884% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.71%. Comparing base (a899f46) to head (63fd0eb).

Files with missing lines Patch % Lines
google/cloud/storage/async/writer_connection.h 0.00% 2 Missing ⚠️
...d/storage/internal/async/writer_connection_impl.cc 94.73% 1 Missing ⚠️
...rage/internal/async/writer_connection_impl_test.cc 98.18% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16112      +/-   ##
==========================================
- Coverage   92.71%   92.71%   -0.01%     
==========================================
  Files        2353     2353              
  Lines      218986   219067      +81     
==========================================
+ Hits       203031   203100      +69     
- Misses      15955    15967      +12     

☔ View full report in Codecov by Sentry.
📢 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.

@kalragauri kalragauri force-pushed the feature/appendable-close branch from 9e71403 to b947f10 Compare May 25, 2026 08:17
@kalragauri kalragauri marked this pull request as ready for review May 25, 2026 09:16
@kalragauri kalragauri requested review from a team as code owners May 25, 2026 09:16
@kalragauri kalragauri requested a review from v-pratap May 25, 2026 09:16
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