Skip to content

feat(storage): add IsOpen API for zonal read operation#16063

Open
v-pratap wants to merge 7 commits intogoogleapis:mainfrom
v-pratap:add-is-open-api
Open

feat(storage): add IsOpen API for zonal read operation#16063
v-pratap wants to merge 7 commits intogoogleapis:mainfrom
v-pratap:add-is-open-api

Conversation

@v-pratap
Copy link
Copy Markdown
Contributor

@v-pratap v-pratap commented Apr 2, 2026

Add IsOpen() to ObjectDescriptor to allow applications to detect if a descriptor is still valid without hanging on a dead connection.

The IsOpen() method returns false if the descriptor has been explicitly cancelled or if all underlying gRPC streams have permanently failed and cannot be resumed. It also incorporates a health check of the underlying gRPC channels.

@v-pratap v-pratap requested review from a team as code owners April 2, 2026 18:03
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Apr 2, 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 an IsOpen() method to the ObjectDescriptor class and its associated connection interfaces, allowing users to verify if a descriptor is still active and the underlying transport is healthy. The implementation includes gRPC channel state monitoring and updated unit tests. Review feedback highlighted a potential crash in ObjectDescriptorImpl::IsOpen() if the transport callback is null, as well as the risk of calling this callback while holding a mutex. Additionally, the permanent_failure_ field was identified as unused and should be either implemented or removed.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 90.74074% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.69%. Comparing base (fdbec33) to head (6f8818c).

Files with missing lines Patch % Lines
...le/cloud/storage/internal/async/connection_impl.cc 57.14% 9 Missing ⚠️
...rnal/async/object_descriptor_connection_tracing.cc 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16063      +/-   ##
==========================================
- Coverage   92.70%   92.69%   -0.01%     
==========================================
  Files        2343     2343              
  Lines      216644   216739      +95     
==========================================
+ Hits       200838   200909      +71     
- Misses      15806    15830      +24     

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

* A descriptor is open if it has not been cancelled and has not hit a
* permanent failure.
*/
virtual bool IsOpen() const { return true; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this have a default implementation that returns true or should it be a pure virtual method with no implementation?

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.

Initially I created this as pure virtual function but was getting this error:
Screenshot 2026-04-06 at 2 06 13 PM

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While this is technically correct, users should not need to inherit from this class except in the case of creating mocks for testing. However, we provide such a mock and this PR updates it accordingly. You will need to check in a new abi dump via:

env GOOGLE_CLOUD_CPP_CHECK_API=storage_grpc ci/cloudbuild/build.sh -t check-api-pr

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.

Nothing Changed, got the same error.
Screenshot 2026-04-07 at 6 21 29 PM

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Running the checkl-api build should have produced a new ci/abi-dumps/google_cloud_cpp_storage_grpc.expected.abi.dump.gz. Add that file to the PR.

Copy link
Copy Markdown
Contributor Author

@v-pratap v-pratap Apr 7, 2026

Choose a reason for hiding this comment

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

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