Skip to content

feat(storage): support pre-warming read ranges in AsyncConnection - #16275

Merged
kalragauri merged 4 commits into
googleapis:mainfrom
kalragauri:feat/fast-open
Aug 3, 2026
Merged

feat(storage): support pre-warming read ranges in AsyncConnection#16275
kalragauri merged 4 commits into
googleapis:mainfrom
kalragauri:feat/fast-open

Conversation

@kalragauri

Copy link
Copy Markdown
Contributor

This PR implements the backend plumbing and happy-path caching to support pre-warming read ranges in the GCS async client.

Key changes:

  • Introduced ReadRangesOption containing a list of ReadRangeConfig (offset and length) to configure which ranges to pre-warm.
  • Updated AsyncConnectionImpl::Open to populate the initial BidiReadObjectRequest with the configured read_ranges.
  • Updated ObjectDescriptorImpl constructor to initialize ReadRange objects for pre-warmed ranges and register them on the initial stream so incoming GCS data chunks are routed correctly and not discarded.
  • Implemented a prewarmed_ranges_ cache in ObjectDescriptorImpl. When the user calls Read(), the cache is checked. On a hit, the pre-warmed ReadRange is claimed and returned as an ObjectDescriptorReader.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 27, 2026

@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 introduces support for pre-warmed ranges in the asynchronous GCS client, allowing specified ranges to be downloaded as soon as a stream opens. It adds the ReadRangesOption configuration, updates AsyncConnectionImpl::Open to populate the initial request with these ranges, and modifies ObjectDescriptorImpl to cache and claim them during reads. The feedback suggests critical improvements to the caching mechanism: using std::multimap instead of std::map to prevent resource leaks when duplicate ranges are configured, using emplace for insertion, and utilizing std::move to avoid unnecessary copies of std::shared_ptr when claiming cached ranges.

Comment thread google/cloud/storage/internal/async/object_descriptor_impl.h
Comment thread google/cloud/storage/internal/async/object_descriptor_impl.cc Outdated
Comment thread google/cloud/storage/internal/async/object_descriptor_impl.cc Outdated
@kalragauri
kalragauri marked this pull request as ready for review July 27, 2026 08:51
@kalragauri
kalragauri requested review from a team as code owners July 27, 2026 08:51
Comment thread google/cloud/storage/internal/async/connection_impl.cc
Comment thread google/cloud/storage/internal/async/object_descriptor_impl.cc Outdated
Comment thread google/cloud/storage/internal/async/object_descriptor_impl.cc Outdated
Comment thread google/cloud/storage/internal/async/object_descriptor_impl.cc
@kalragauri
kalragauri enabled auto-merge (squash) August 3, 2026 04:36
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.28058% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.31%. Comparing base (6f13a6b) to head (b21c151).

Files with missing lines Patch % Lines
...torage/internal/async/connection_impl_open_test.cc 98.90% 1 Missing ⚠️
...d/storage/internal/async/object_descriptor_impl.cc 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16275      +/-   ##
==========================================
+ Coverage   92.29%   92.31%   +0.01%     
==========================================
  Files        2226     2226              
  Lines      208573   208851     +278     
==========================================
+ Hits       192504   192792     +288     
+ Misses      16069    16059      -10     

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

@kalragauri

Copy link
Copy Markdown
Contributor Author

/gcbrun

@kalragauri
kalragauri merged commit b737013 into googleapis:main Aug 3, 2026
60 of 63 checks passed
@kalragauri
kalragauri deleted the feat/fast-open branch August 3, 2026 09:12
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