Warm: Eager Loading + Tiered Cache#22265
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit e5fe9ad.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
13612e7 to
43ac44d
Compare
…instances Introduces TieredBlockCache: a two-tier SSD block cache that physically separates Parquet metadata from column data. Components: - TieredBlockCache: routes get() to probe metadata Foyer first, then data Foyer. put() → data Foyer only. put_metadata() → metadata Foyer with configurable max_metadata_entry_size bound (default 10MB, dynamic). - FoyerCache: added reinsertion_admit_all parameter for AdmitAll filter on the metadata instance. Added HybridCache::close() on drop to flush partial blocks to SSD (fixes entries < block_size surviving restart). - BlockCache trait: added put_metadata() with default fallback to put(). - FFM: foyer_create_tiered_cache, foyer_update_max_metadata_entry_size. - 11 unit tests validating routing, isolation, key alignment. Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
Integrates the TieredBlockCache with TieredObjectStore and adds the warmup path for metadata population: TieredObjectStore changes: - get_opts: probes cache via try_serve_from_cache() for range reads. Resolves Bounded/Suffix/Offset ranges to absolute offsets. Serves hits from metadata Foyer (put there by warmup). No auto-populate. - get_ranges: unchanged (probe → fetch misses → put to data Foyer). - put_metadata(path, ranges, data): stores bytes directly into metadata Foyer. - ts_put_metadata FFM entry point for Java warmup. Warmup (custom_cache_manager): - warmup_file_with_store(): footer-only to heap (PageIndexPolicy::Skip), computes global page index range (matches parquet crate range_for_page_index), fetches index bytes through store, returns for promotion to metadata Foyer. - compute_page_index_range(): extracted helper, folds ALL columns × ALL RGs. - df_cache_manager_add_files_with_store FFM for warm-node init. Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
…quet + DataFusion Comprehensive integration tests proving correctness across init, query, delete, and restart lifecycles: End-to-end production path: - production_warmup_then_query_from_cache_only: warmup → SQL → delete file → SQL from cache - restart_with_file_deleted_query_succeeds_from_foyer_only: cross-session Foyer recovery - datafusion_query_succeeds_from_cache_after_local_file_deleted: key alignment proof Cache isolation: - metadata_routed_to_metadata_cache_data_to_data_cache - get_opts_probe_does_not_pollute_metadata_foyer - data_pressure_does_not_evict_metadata Page index correctness: - page_index_key_alignment_warmup_matches_query_time: global range serves from cache - page_index_ranges_match_parquet_crate_computation: fold covers all column ranges Robustness: - concurrent_shard_warmup_does_not_corrupt: 5 parallel warmups - metadata_foyer_capacity_breach_graceful_degradation: no panics under pressure - suffix_fetch_resolves_and_hits_cache: GetRange::Suffix resolution - metadata_served_from_ssd_not_local_fs: file deleted, cache serves - metadata_survives_restart_via_foyer_recovery: byte-for-byte recovery Shared test helpers: compute_global_page_index_range, setup_df_session, write_page_indexed_parquet. Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
…ted API 1. FoyerCache::drop(): add 5s timeout to HybridCache::close() to prevent indefinite blocking if the flusher is stuck during shutdown. 2. TieredObjectStore::resolve_range(): log debug warning when file_size is unavailable for Suffix/Offset resolution (cache bypassed silently before). 3. TieredBlockCache::put_metadata(): detect metadata Foyer at capacity and route new entries to data_cache (evictable) as graceful degradation. Also respects max_metadata_entry_size bound (10MB default, dynamic). New FFM: foyer_update_max_metadata_entry_size. 4. fetch_footer_to_heap(): document panic contract (block_on not async-safe). 5. Integration tests: migrate deprecated API, add two new tests: - oversized_metadata_routes_to_data_cache: entry > limit → data cache - metadata_cache_full_routes_new_entries_to_data_cache: capacity → data cache Total: 90 tests passing (22 integration + 68 unit). Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
…ectStore Adds Java-side FFM bindings for the warm-node metadata warmup path: 1. NativeBridge.cacheManagerAddFilesWithStore(runtime, storePtr, files) - Calls df_cache_manager_add_files_with_store FFM - Reads metadata through TieredObjectStore (routes to S3 for warm nodes) - Footer → heap cache; page indexes → fetched for Foyer promotion 2. TieredStorageBridge.putMetadata(storePtr, path, ranges, dataArrays) - Calls ts_put_metadata FFM - Stores byte ranges directly into metadata Foyer (never-evict tier) 3. DataFusionService.onFilesAddedWithStore(filePaths, storeBoxPtr) - New method for warm-node warmup - Uses TieredObjectStore instead of LocalFileSystem Java warmup sequence for warm nodes: long boxPtr = TieredStorageBridge.getObjectStoreBoxPtr(storePtr); dataFusionService.onFilesAddedWithStore(files, boxPtr); TieredStorageBridge.putMetadata(storePtr, path, ranges, bytes); TieredStorageBridge.destroyObjectStoreBoxPtr(boxPtr); Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
Add percentage-based settings for data/metadata cache split and separate stats reporting for each Foyer cache tier in the node stats REST response. Settings: - block_cache.foyer.metadata_cache_ratio (default: 5%) - block_cache.foyer.metadata_block_size (default: 8mb) Stats: - BlockCacheTieredStats record with per-tier counters - data_cache_stats / metadata_cache_stats in block_cache JSON - Version-gated wire format (V_3_8_0) Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
Signed-off-by: Vishwas Garg <vishwasgarg14@gmail.com>
Signed-off-by: Vishwas Garg <vishwasgarg14@gmail.com>
Signed-off-by: Vishwas Garg <vishwasgarg14@gmail.com>
Signed-off-by: Vishwas Garg <vishwasgarg14@gmail.com>
43ac44d to
e5fe9ad
Compare
PR Reviewer Guide 🔍(Review updated until commit f91c4b5)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to f91c4b5 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 1f3671e
Suggestions up to commit 46e6290
|
|
❌ Gradle check result for 46e6290: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Vishwas Garg <vishwasgarg14@gmail.com>
46e6290 to
1f3671e
Compare
|
Persistent review updated to latest commit 1f3671e |
|
❌ Gradle check result for 1f3671e: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit f91c4b5 |
|
❌ Gradle check result for f91c4b5: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Description
[Describe what this change achieves]
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.