[core] Prune manifest blocks with sidecars during scans - #9897
leaves12138 wants to merge 4 commits into
Conversation
| Path path = pathFactory.toPath(fileName); | ||
| if (cache != null) { | ||
| // Sidecar selections use the block cache, even when every block is selected. | ||
| if (cache != null && selected == null) { |
There was a problem hiding this comment.
[P2] Reuse an existing whole-manifest cache hit before reading selected blocks
With manifest.sidecar.enabled=true and sink.writer-coordinator.prefetch-manifests=true, TableWriteCoordinator.refresh() warms the whole-manifest entry cache through an unfiltered scan. Its subsequent restore requests use withPartitionBucket(...), so sidecar selection becomes non-null and this condition bypasses those already-cached entries. The selected-block reader only checks BlockCacheKey, whereas prefetch populated the Path key, so the first access to each uncached block reads the manifest again—even when every block is selected. This defeats the existing prefetch behavior and adds storage I/O and Avro decoding during writer recovery.
I reproduced this with a recording FileIO: an unfiltered scan populated ManifestEntrySegments, then a bucket-filtered scan reopened both the sidecar and the manifest despite the complete entry cache still being present.
Could we reuse an existing whole-manifest cache hit first and use selected-block reads only on a miss? Partial results should still never populate the whole-manifest cache.
Purpose
Wire manifest sidecars into Java scans, following the format (#9845), lifecycle (#9886), and writer (#9889) changes. Extracted from #9743 after rebasing the tracking PR onto current master.
manifest.sidecar.enabled; no additional read option is introduced.ManifestFile.readoverloads for callers that do not supply a block selection.No file-format, writer, lifecycle or Python changes are included.
Tests
Java 8: 195 targeted tests passed with Checkstyle and Spotless enabled.
Tests cover row-ID, partition-only and bucket-only pruning; nullable coverage; real seek/byte-read accounting; repeated partial/all-block cache reads; explicit/custom references; disabled and unfiltered reads; missing/corrupt sidecar fallback while preserving deletes and overlapping row-ID groups; and existing data-evolution, bucket-filter, primary-key and global-index scans.
mvn -B -ntp -nsu -pl paimon-core -am -DwildcardSuites=none -DfailIfNoTests=false -Dflink.forkCount=2 \ -Dtest=ManifestFileTest,ManifestSidecarTest,ManifestSidecarWriteTest,ManifestBlockIndexTest,DataEvolutionFileStoreScanTest,BucketFilterScanTest,KeyValueFileStoreScanTest,DataEvolutionBatchScanTest test