Skip to content

Conversation

@Tulsishah
Copy link
Collaborator

@Tulsishah Tulsishah commented Jan 6, 2026

Description

The primary goal of this PR is to provide a mechanism to explicitly control whether a metadata request should be served from the local cache or fetched directly from GCS.

Changes By adding FetchFromCache to the request structs, the system can now prioritize fetching responses from the stat cache. If the entry is not found, it will fall back to making GCS calls.

Updates to Fast Stat Bucket

  1. ListObjects: If the deprecation flag is enabled and FetchFromCache is true, the method attempts to retrieve the entry from the cache. Otherwise, it falls back to the existing approach of fetching directly from GCS.
  2. StatObject / GetFolder: Added checks for the TypeCache deprecation flag to handle scenarios where FetchFromCache is either true or false.

Link to the issue in case of a bug fix.

b/473671143

Testing details

  1. Manual - NA
  2. Unit tests - NA
  3. Integration tests - Automated

Any backward incompatible change? If so, please explain.

@Tulsishah Tulsishah added execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. labels Jan 6, 2026
@Tulsishah Tulsishah force-pushed the fetch_from_cache_arg_in_req_struct branch 2 times, most recently from 6089975 to df74e56 Compare January 6, 2026 05:28
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 86.36364% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.10%. Comparing base (8985dad) to head (b8f1a0e).

Files with missing lines Patch % Lines
internal/storage/debug_bucket.go 0.00% 3 Missing ⚠️
internal/monitor/bucket.go 0.00% 2 Missing ⚠️
internal/ratelimit/throttled_bucket.go 0.00% 2 Missing ⚠️
internal/storage/caching/fast_stat_bucket.go 94.44% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4243   +/-   ##
=======================================
  Coverage   83.09%   83.10%           
=======================================
  Files         154      154           
  Lines       18980    19008   +28     
=======================================
+ Hits        15772    15796   +24     
- Misses       2631     2635    +4     
  Partials      577      577           
Flag Coverage Δ
unittests 83.10% <86.36%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Tulsishah Tulsishah marked this pull request as ready for review January 6, 2026 08:37
@Tulsishah Tulsishah requested a review from a team as a code owner January 6, 2026 08:37
@Tulsishah Tulsishah requested a review from raj-prince January 6, 2026 08:37
@github-actions github-actions bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Jan 6, 2026
@Tulsishah
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@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 refactors the GetFolder function across various bucket abstraction layers to accept a *gcs.GetFolderRequest struct instead of a direct folder name string, with corresponding updates to test files. The gcs.GetFolderRequest struct, along with StatObjectRequest and ListObjectsRequest, now includes a FetchFromCache boolean field. Review comments indicate that the FetchFromCache flag is not yet implemented for StatObject within fastStatBucket.StatObject and that fastStatBucket.ListObjects does not currently utilize caching for listings, prompting a need for further implementation or clarification on future plans.

@Tulsishah Tulsishah force-pushed the fetch_from_cache_arg_in_req_struct branch 3 times, most recently from e362824 to 2cf7164 Compare January 7, 2026 03:12
@Tulsishah Tulsishah changed the title feat(Type Cache Deprecation): Add FetchFromCache arg in req struct feat(Type Cache Deprecation): Add FetchFromCache flag and support implicit directory caching in Stat Cache Jan 7, 2026
@Tulsishah
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@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 a FetchFromCache flag to give callers explicit control over using the stat cache, which is a useful feature for performance tuning and consistency. The changes are well-contained, primarily affecting the fastStatBucket and propagating the new request structs through various bucket wrappers.

My review focuses on the new caching logic in fast_stat_bucket.go. I've identified a couple of areas for improvement:

  • A potential panic due to an unsafe type assertion in ListObjects.
  • A minor formatting inconsistency in an error message.

The addition of extensive unit tests for the new caching scenarios is excellent and greatly improves confidence in the changes. Overall, this is a solid contribution.

@Tulsishah Tulsishah changed the title feat(Type Cache Deprecation): Add FetchFromCache flag and support implicit directory caching in Stat Cache feat(Type Cache Deprecation): Add FetchFromCache flag and enable/disable caching with respect to flag value Jan 7, 2026
@Tulsishah Tulsishah force-pushed the fetch_from_cache_arg_in_req_struct branch from 384b757 to b8f1a0e Compare January 7, 2026 05:08
@Tulsishah Tulsishah added type-cache-deprecation and removed remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. labels Jan 7, 2026
@Tulsishah Tulsishah removed the request for review from raj-prince January 7, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. type-cache-deprecation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant