Repository navigation
fix(flink): prune partitions before incremental file checks - #20995
VirtualSelect wants to merge 3 commits into
Conversation
cshuo
left a comment
There was a problem hiding this comment.
The pruning change looks good to me. All 28 TestIncrementalInputSplits cases passed locally on Flink 1.20.1 with JDK 21. Restoring the old planner calls made both new cases fail on the excluded par2 probe. I have two suggestions for strengthening the regression coverage.
| assertTrue(selected.inputSplits(metaClient, false).isEmpty()); | ||
| assertTrue(selected.inputSplits(metaClient, null, false).isEmpty()); |
There was a problem hiding this comment.
Could we keep an older committed base file in par1 when deleting the file referenced by the selected commit? With the current fixture, I changed the bounded call to ignoreMissingFiles = true and both cases still passed. With the older file present, bounded planning recovered its path and streaming returned zero splits. Asserting those two results caught the flag change for both COW and MOR.
There was a problem hiding this comment.
Thanks for testing both failure modes. In 5fab315, deleting the selected instant’s file now recovers the older committed file for bounded reads and produces no streaming splits. Setting ignoreMissingFiles=true on the bounded path fails both the COW and MOR cases. The additional MOR test checks that both planning paths retain two logs for one file group; switching to file-ID lookup drops the older log and fails. All three focused cases passed on Flink 1.20.1. The wider local run was limited by the embedded timeline service’s network-dependent hostname lookup.
| for (String partition : Arrays.asList("par1", "par2")) { | ||
| String fileId = "file-" + partition; | ||
| StoragePath file = new StoragePath(FileCreateUtils.createBaseFile(metaClient, partition, instant, fileId, 100L)); |
There was a problem hiding this comment.
Could the MOR case append two distinct logs to the same selected file group in successive delta commits and assert that both paths appear in the split? With one base file per file ID, the test still passed when I routed MOR through the COW getFileIdToInfo lookup. I tried the two-commit fixture and it caught that change when the earlier log disappeared from the split.
Assisted-by: OpenAI ChatGPT
cshuo
left a comment
There was a problem hiding this comment.
LGTM, the updated tests cover both review concerns. cc @danny0405
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20995 +/- ##
============================================
- Coverage 80.95% 79.70% -1.26%
+ Complexity 36732 36156 -576
============================================
Files 2600 2600
Lines 149464 149486 +22
Branches 18630 18634 +4
============================================
- Hits 120998 119142 -1856
- Misses 20058 22039 +1981
+ Partials 8408 8305 -103
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| probes.clear(); | ||
| assertEquals(Collections.singletonList("par1"), getFilteredPartitions(selected.inputSplits(metaClient, false))); |
There was a problem hiding this comment.
Could we add a second file group to par1 in commit 001 and leave it untouched in 002? I forced the bounded planner to take the full-scan fallback after a successful filtered lookup, and all three new cases still passed. With the extra group, the incremental lookup returns one split here and the full scan returns two. I tried that fixture on Flink 1.20.1. Both COW and MOR caught the forced fallback, and all three cases passed on the PR head after updating the later fallback assertion to expect both older files.
| assertEquals(Arrays.asList("par1", "par2"), getFilteredPartitions(all.inputSplits(metaClient, false))); | ||
| assertEquals(Arrays.asList("par1", "par2"), getFilteredPartitions(all.inputSplits(metaClient, null, false))); |
There was a problem hiding this comment.
Could these two assertions compare the partition names in any order, while still checking that each occurs exactly once? Both splits have the same latest commit, so their relative order comes from iterating the partition set. Sorting the actual names before comparing would keep the duplicate-split check and allow either valid order.
| HoodieTableType tableType, | ||
| boolean ignoreMissingFiles, | ||
| @Nullable Set<String> selectedPartitions) { | ||
| Predicate<String> partitionFilter = selectedPartitions == null ? partition -> true : selectedPartitions::contains; |
There was a problem hiding this comment.
Could this overload take a Predicate<String> partitionFilter directly? Both planner callers can pass readPartitions::contains, and the existing unfiltered overload can pass partition -> true. That removes the nullable-set convention and this conversion while preserving the existing overloads.
Use a partition predicate and keep order-independent assertions multiplicity-aware. Assisted-by: OpenAI ChatGPT
|
Thanks for the fixture and API suggestions. |
Describe the issue this Pull Request addresses
Closes #20989.
Summary and Changelog
Apply the planner's existing partition selection before building file statuses and checking storage on bounded and streaming non-CDC incremental reads. Keep the existing COW file-ID and MOR full-path lookup keys, reverse commit order, and handling of missing files within the selected partitions. No change to CDC or partition selection.
Impact
Avoids probing excluded files and prevents an excluded file removed by the cleaner from triggering the bounded full-scan fallback. No config or storage format change. No object-store latency or throughput claims.
Risk Level
Low. Added a Flink 1.20 planner regression using real local commit metadata and filesystem paths for COW and MOR. It compares unfiltered output, excludes a missing file without probing it, and exercises a missing selected file in bounded and streaming reads. Both variants failed on the pre-fix implementation at the excluded-file probe assertion and both passed with this patch (JDK 21).
Documentation Update
None.
Contributor's checklist
AI assistance was used in preparing and verifying this change.