Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors bucket type detection by replacing the BucketType enum with a detailed BucketLayout dataclass, which tracks storage class, caching tier, and namespace layout. This allows Rapid Cache Ultra (RCU) buckets to utilize the gRPC data path (ZonalFile) for read operations. The review feedback correctly identifies that read-write modes (such as r+) should be excluded from using ZonalFile for RCU buckets, as writes are not yet supported over the gRPC path.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1134 +/- ##
==========================================
+ Coverage 92.24% 92.25% +0.01%
==========================================
Files 20 20
Lines 4047 4055 +8
==========================================
+ Hits 3733 3741 +8
Misses 314 314 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
41506b9 to
f80cb0e
Compare
zhixiangli
left a comment
There was a problem hiding this comment.
Thanks! I ran the read path on real buckets with google-cloud-storage-control==1.14.0:
yuxinj-us-central1-standard-rcu→ STANDARD_RCUyuxinj-us-central1-hns-rcu→ HIERARCHICAL_RCUchandrasiri-benchmarks-rb→ plain RAPID_CACHE
RCU open("rb"), cat_file, cat_ranges and the 5 MiB disk threshold all go through MRD and return correct data. wb/ab/xb on RCU still return GCSFile and round-trip over HTTP. Plain Rapid Cache stays on HTTP.
One real issue: read-write modes on RCU buckets leak an MRD pool. Details and a repro are in a reply on the existing _open thread. The two inline comments here are test-coverage suggestions.
e77d0ea to
b86d70c
Compare
b86d70c to
aa46c4b
Compare
zhixiangli
left a comment
There was a problem hiding this comment.
Two more things from re-running against the real RCU buckets at aa46c4b. Layout detection still matches the server (rapid-cache-ultra / rapid-cache), and RCU reads over MRD return correct data.
test_core.py read-path tests vs RCU (non-blocking). skip_if_zonal checks is_zonal, so it doesn't skip RCU, but RCU reads no longer use HTTP. If TEST_BUCKET were an RCU bucket, these would fail (I replayed the assertions on the real bucket):
test_cat_file_routing_and_thresholds:_cat_file_sequentialcalled 0 times, expected 1test_cat_file_explicit_concurrency:_cat_file_concurrentcalled 0 times, expected 1test_user_agent_includes_cache_type_and_source_in_read: nocache_type/mmap:eUser-Agent (its inline check also uses_is_zonal_bucket)
Suggest a skip_if_grpc_read fixture keyed on uses_grpc_data_path for these three. Keep skip_if_zonal for the write and precondition tests, since RCU writes stay on HTTP. CI doesn't run test_core.py on RCU today, so this is latent.
Nits:
test_get_threshold_for_disk_reads_http_buckets_delegates_to_superis missinglayouts.HIERARCHICAL_RAPID_CACHEandBucketLayout.UNKNOWN, whichtest_cat_ranges_non_zonal_delegates_to_fsspecalready lists.test_fetch_range_split_concurrent_{success,exception}intest_zonal.pystill patch_is_zonal_bucket, which isn't called there. The neighbouring tests moved to_uses_grpc_data_path.
zhixiangli
left a comment
There was a problem hiding this comment.
Inline details for the generation and "Short read" bullets in my earlier review summary. Both were reproduced on yuxinj-us-central1-standard-rcu at aa46c4b.
…yout tests - Add a skip_if_grpc_read fixture that skips when TEST_BUCKET is a Zonal or RCU bucket (both read over gRPC), and use it in the test_core.py tests that assert HTTP read internals: test_cat_file_routing_and_thresholds, test_cat_file_explicit_concurrency and test_user_agent_includes_cache_type_and_source_in_read (replacing its inline zonal-only check). - Cover the HIERARCHICAL_RAPID_CACHE and UNKNOWN layouts in test_get_threshold_for_disk_reads_http_buckets_delegates_to_super. - Drop the unused _is_zonal_bucket patch from the test_fetch_range_split_concurrent_* tests; _fetch_range_split does not check the bucket type.
|
Done for |
Summary
Detects Rapid Cache Ultra (RCU) buckets from the
rapid_cache_infofield returned byGetStorageLayout, and reads from them through the gRPC Multi-Range Downloader (MRD) path that zonal buckets already use. In this PR, writes to RCU buckets still go throughGCSFileover HTTP. gRPC appendable writes will come in a separate PR.Changes
gcsfs/extended_gcsfs.py):_get_bucket_layoutmapsrapid_cache_info.cache_typeto aCachingTier:"rapid-cache-ultra"becomesRAPID_CACHE_ULTRA,"rapid-cache"becomesRAPID_CACHE, and a missing, empty, or unrecognized value becomesNONE.gcsfs/extended_gcsfs.py):_cat_file,_cat_ranges,_get_file_request,_get_file_concurrentand_get_threshold_for_disk_readsnow check_uses_grpc_data_pathinstead of_is_zonal_bucket, so RCU buckets read through MRD. Buckets with a plain Rapid Cache (RAPID_CACHE) stay on HTTP._openreturns aZonalFilefor"rb"on RCU buckets and keepsGCSFilefor all other modes.pyproject.toml): requiregoogle-cloud-storage-control>=1.14.0, the first release withStorageLayout.rapid_cache_info.gcsfs/tests/test_hns_unit.py: real-StorageLayout-proto detection cases for empty, unrecognized,rapid-cacheandrapid-cache-ultracache types on flat and HNS buckets, plus HNS routing coverage on RCU layouts.gcsfs/tests/test_zonal_unit.py: runs the existing MRD read tests (cat_file,cat_ranges,get_file, the prefetcher and MRD error handling) against flat and HNS RCU layouts, and covers_get_threshold_for_disk_readson gRPC and HTTP layouts,_openclass routing acrosswb/ab/xband HTTP/Rapid Cache/UNKNOWNlayouts,cat_rangesfallback on non-gRPC layouts, and+-mode rejection without checking out an MRD pool.gcsfs/tests/test_zonal.py: tests that force the MRD read path now mock_uses_grpc_data_pathinstead of_is_zonal_bucket.gcsfs/tests/conftest.py,gcsfs/tests/test_core.py: a newskip_if_grpc_readfixture skips thetest_core.pytests that check HTTP read internals whenTEST_BUCKETis a zonal or RCU bucket.