Skip to content

feat(storage): implement appendable upload connector#5956

Open
vsharonlynn wants to merge 3 commits into
googleapis:mainfrom
vsharonlynn:appendable_upload_3
Open

feat(storage): implement appendable upload connector#5956
vsharonlynn wants to merge 3 commits into
googleapis:mainfrom
vsharonlynn:appendable_upload_3

Conversation

@vsharonlynn

Copy link
Copy Markdown
Contributor

This PR comes after PR #5932.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jun 28, 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 introduces the appendable_object_writer module and supporting bidi_write infrastructure to enable bidirectional streaming writes for Google Cloud Storage. Key feedback includes avoiding .expect() on parameter conversions to prevent panics, simplifying complex string-folding logic, removing an unnecessary clone of the request object, and ensuring the background worker fails loudly with an explicit error if the stream closes unexpectedly while flushes are pending.

Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/worker.rs Outdated
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.05506% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.75%. Comparing base (affbeb2) to head (8fcbb33).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
src/storage/src/storage/bidi_write/connector.rs 97.60% 12 Missing ⚠️
src/storage/src/storage/bidi_write/state.rs 97.23% 7 Missing ⚠️
src/storage/src/storage/bidi_write/mocks.rs 85.71% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5956      +/-   ##
==========================================
+ Coverage   97.73%   97.75%   +0.02%     
==========================================
  Files         244      247       +3     
  Lines       61096    61799     +703     
==========================================
+ Hits        59710    60412     +702     
- Misses       1386     1387       +1     

☔ 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.

@joshuatants joshuatants 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.

We're gone through this extensively offline.

Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/redirect.rs Outdated
Comment thread src/storage/src/storage/bidi_write/transport.rs Outdated
@vsharonlynn vsharonlynn force-pushed the appendable_upload_3 branch 8 times, most recently from f3e8345 to 4c4b7be Compare June 29, 2026 11:57
@vsharonlynn vsharonlynn marked this pull request as ready for review June 29, 2026 12:02
@vsharonlynn vsharonlynn requested review from a team as code owners June 29, 2026 12:02
@vsharonlynn vsharonlynn force-pushed the appendable_upload_3 branch 2 times, most recently from 1713d73 to 9cca986 Compare June 29, 2026 17:13

@coryan coryan 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.

This is still too large. Aim for at most 200 lines of new code, which probably means 400 to 600 lines per PR. 1600 lines is simply too large.

Comment thread src/storage/src/storage/bidi_write/connector.rs
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write.rs Outdated
Comment thread src/storage/src/storage/bidi_write/worker.rs Outdated
Comment thread src/storage/src/storage/bidi_write/worker.rs Outdated
@vsharonlynn

Copy link
Copy Markdown
Contributor Author

This is still too large. Aim for at most 200 lines of new code, which probably means 400 to 600 lines per PR. 1600 lines is simply too large.

Ok. I am going to split this PR into smaller PRs. I'll update once done. Thank you and sorry about this!

@vsharonlynn vsharonlynn force-pushed the appendable_upload_3 branch from 9cca986 to e86f327 Compare July 8, 2026 02:58
@vsharonlynn vsharonlynn changed the title feat(storage): implement transport, connector, worker feat(storage): implement appendable upload connector Jul 8, 2026
@vsharonlynn

Copy link
Copy Markdown
Contributor Author

This is still too large. Aim for at most 200 lines of new code, which probably means 400 to 600 lines per PR. 1600 lines is simply too large.

Ok. I am going to split this PR into smaller PRs. I'll update once done. Thank you and sorry about this!

I split this PR into three PRs:

Thank you.

@vsharonlynn vsharonlynn requested a review from coryan July 9, 2026 08:53
Comment thread src/storage/src/storage/bidi_write/redirect.rs Outdated
Comment thread src/storage/src/storage/bidi_write/redirect.rs Outdated
Comment thread src/storage/src/storage/bidi_write/redirect.rs Outdated
#[derive(Clone, Debug)]
#[allow(dead_code)]
pub enum AppendObjectSpecState {
Write(Box<WriteObjectSpec>, Option<String>),

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.

Why a Box<WriteObjectSpec> ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without Box it fails the clippy::large_enum_variant check.

AppendObjectSpecState can either be Append or Write.
Write contains WriteObjectSpec. WriteObjectSpec is large, contains Option<Object>. And Object is a large struct containing many fields.
In Rust, an enum takes a memory of the largest variant, so if WriteObjectSpec is not boxed, AppendObjectSpecState with Append variant will take up memory that fits WriteObjectSpec which is unnecessarily large.

Should I do this way with Box; or without Box but will need #[allow(clippy::large_enum_variant)] macro?

Thanks!

Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
Comment thread src/storage/src/storage/bidi_write/connector.rs Outdated
@vsharonlynn vsharonlynn force-pushed the appendable_upload_3 branch from a947a8c to 366919e Compare July 10, 2026 06:20
@vsharonlynn vsharonlynn requested a review from coryan July 10, 2026 06:43
@vsharonlynn vsharonlynn force-pushed the appendable_upload_3 branch from 366919e to 8fcbb33 Compare July 10, 2026 07:57

@coryan coryan 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.

LGTM.

For future reference, avoid PRs with 1,000 lines of code (such as this one). It makes it hard to review them thoroughly. This may contradict what other reviewers want (a full picture of all the changes). Consider a draft PR with the full thing and smaller PRs that are part of the changes.

Comment on lines +222 to +224
Err(status) => {
let mut guard = spec.lock().expect("never poisoned");
Err(guard.handle_redirect(status))

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.

optional: the code coverage says this case is not tested. Seems like an important behavior to test

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.

3 participants