Skip to content

feat(storage): implement appendable upload transport#6002

Draft
vsharonlynn wants to merge 3 commits into
googleapis:mainfrom
vsharonlynn:appendable_upload_3_3
Draft

feat(storage): implement appendable upload transport#6002
vsharonlynn wants to merge 3 commits into
googleapis:mainfrom
vsharonlynn:appendable_upload_3_3

Conversation

@vsharonlynn

Copy link
Copy Markdown
Contributor

This PR comes after #6001.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 8, 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 internal infrastructure for Appendable Object Write (Bidi Write), including a Connector for establishing connections, a background Worker to manage the gRPC stream, and an AppendableObjectWriterTransport adapter. Feedback highlights a critical issue in connector.rs where the preconditions if_metageneration_match and if_metageneration_not_match are dropped when transitioning from WriteObjectSpec to AppendObjectSpec after a successful initial response, which could cause race conditions or incorrect writes during reconnection attempts.

Comment on lines +278 to +292
AppendObjectSpecState::Append(AppendObjectSpec {
bucket: s
.resource
.as_ref()
.map(|r| r.bucket.clone())
.unwrap_or_default(),
object: s
.resource
.as_ref()
.map(|r| r.name.clone())
.unwrap_or_default(),
generation: new_generation.unwrap_or(0),
write_handle: m.write_handle.clone(),
..Default::default()
})

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.

high

When transitioning from WriteObjectSpec to AppendObjectSpec upon a successful initial response, the preconditions if_metageneration_match and if_metageneration_not_match are currently dropped (set to None via ..Default::default()).

If a subsequent append fails and the connector attempts to reconnect/reopen, these preconditions will be missing from the retry request, which could lead to race conditions or incorrect writes if the object's metadata has changed.

We should preserve these preconditions from the original WriteObjectSpec.

                        AppendObjectSpecState::Append(AppendObjectSpec {
                            bucket: s
                                .resource
                                .as_ref()
                                .map(|r| r.bucket.clone())
                                .unwrap_or_default(),
                            object: s
                                .resource
                                .as_ref()
                                .map(|r| r.name.clone())
                                .unwrap_or_default(),
                            generation: new_generation.unwrap_or(0),
                            write_handle: m.write_handle.clone(),
                            if_metageneration_match: s.if_metageneration_match,
                            if_metageneration_not_match: s.if_metageneration_not_match,
                            ..Default::default()
                        })

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.36862% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.74%. Comparing base (affbeb2) to head (31a22b9).

Files with missing lines Patch % Lines
src/storage/src/storage/bidi_write/worker.rs 82.03% 23 Missing ⚠️
src/storage/src/storage/bidi_write/transport.rs 96.03% 12 Missing ⚠️
src/storage/src/storage/bidi_write/connector.rs 98.03% 10 Missing ⚠️
src/storage/src/storage/bidi_write/redirect.rs 95.50% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6002      +/-   ##
==========================================
+ Coverage   97.73%   97.74%   +0.01%     
==========================================
  Files         244      248       +4     
  Lines       61096    62135    +1039     
==========================================
+ Hits        59710    60733    +1023     
- Misses       1386     1402      +16     

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

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