Skip to content

feat(storage): Add full object checksum validation for appendable uploads#16219

Open
v-pratap wants to merge 16 commits into
googleapis:mainfrom
v-pratap:fastbyte-full-object-checksum-final
Open

feat(storage): Add full object checksum validation for appendable uploads#16219
v-pratap wants to merge 16 commits into
googleapis:mainfrom
v-pratap:fastbyte-full-object-checksum-final

Conversation

@v-pratap

Copy link
Copy Markdown
Contributor

No description provided.

@v-pratap v-pratap requested review from a team as code owners June 30, 2026 06:34
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jun 30, 2026
@v-pratap v-pratap requested a review from kalragauri June 30, 2026 06:34
@v-pratap v-pratap force-pushed the fastbyte-full-object-checksum-final branch from 3aad347 to 915cef5 Compare June 30, 2026 06:35

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

Copy link
Copy Markdown

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 adds support for CRC32C checksum validation during asynchronous uploads, specifically during finalization, resume, and flush operations. It updates the AsyncWriter interface and its underlying connection implementations to accept and verify expected checksums, and enhances HashFunction to support state retrieval and restoration. The review feedback highlights three critical issues: a compilation error in AsyncWriterConnectionImpl::Finalize caused by inconsistent return types in a lambda, and two data races in AsyncWriterConnectionResumed where impl_ is accessed concurrently without holding the appropriate mutex lock.

Comment thread google/cloud/storage/internal/async/writer_connection_impl.cc
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
@v-pratap v-pratap added the do not review Indicates a PR is not ready for review label Jun 30, 2026
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.30332% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.21%. Comparing base (559b727) to head (2a7d908).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...le/cloud/storage/internal/async/connection_impl.cc 48.14% 14 Missing ⚠️
google/cloud/storage/internal/hash_function_impl.h 0.00% 14 Missing ⚠️
...torage/internal/async/writer_connection_resumed.cc 77.77% 8 Missing ⚠️
...orage/internal/async/writer_connection_buffered.cc 54.54% 5 Missing ⚠️
google/cloud/storage/internal/hash_function.h 0.00% 4 Missing ⚠️
google/cloud/storage/async/writer.cc 71.42% 2 Missing ⚠️
...torage/internal/async/writer_connection_tracing.cc 60.00% 2 Missing ⚠️
google/cloud/storage/testing/mock_hash_function.h 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16219      +/-   ##
==========================================
- Coverage   92.23%   92.21%   -0.03%     
==========================================
  Files        2265     2265              
  Lines      210210   210211       +1     
==========================================
- Hits       193894   193845      -49     
- Misses      16316    16366      +50     

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

@v-pratap v-pratap removed the do not review Indicates a PR is not ready for review label Jun 30, 2026
Comment thread google/cloud/storage/internal/async/writer_connection_impl.cc Outdated
@v-pratap v-pratap force-pushed the fastbyte-full-object-checksum-final branch from 006eeda to 9fca72d Compare July 1, 2026 13:35
@v-pratap v-pratap requested a review from kalragauri July 1, 2026 13:47
Comment thread google/cloud/storage/internal/async/writer_connection_impl.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
@v-pratap v-pratap requested a review from kalragauri July 2, 2026 12:17
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/writer_connection_resumed.cc Outdated
Comment thread google/cloud/storage/internal/async/connection_impl.cc Outdated
…tate to avoid offset rewinding and MD5 errors
@v-pratap v-pratap requested a review from kalragauri July 3, 2026 07:06
future<StatusOr<google::storage::v2::Object>> Finalize(AsyncToken token);
future<StatusOr<google::storage::v2::Object>> Finalize(
AsyncToken token,
absl::optional<Crc32cChecksumValue> const& expected_checksum);

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.

nit: https://google.github.io/styleguide/cppguide.html#Inputs_and_Outputs recommends avoiding absl::optional<T> const&.
If possible, we should either pass std::optional<T> by value (if it's a by-value input) or pass const T* (if it would otherwise be passed by reference).

v-pratap added 3 commits July 8, 2026 09:10
Based on the revised design, full-object checksum verification is exclusively
handled server-side at Finalize(), eliminating the need for continuous
client-side incremental hashing across the stream.

- Removed dynamic hash computation from CreateHashFunction for all async writers.
- Removed dead client-side mismatch checking in AsyncWriterConnectionImpl and AsyncWriterConnectionResumed.
- Consolidated appendable and standard hash creation to use PrecomputedHashFunction only.
- Cleaned up obsolete tests asserting client-side hash mismatch failures.
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.

2 participants