TheR1sing3un commented on code in PR #13342:
URL: https://github.com/apache/hudi/pull/13342#discussion_r2102342300
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/SparkInsertOverwriteCommitActionExecutor.java:
##########
@@ -96,8 +96,8 @@ protected Map<String, List<String>>
getPartitionToReplacedFileIds(HoodieWriteMet
}
protected List<String> getAllExistingFileIds(String partitionPath) {
- // because new commit is not complete. it is safe to mark all existing
file Ids as old files
- return
table.getSliceView().getLatestFileSlices(partitionPath).map(FileSlice::getFileId).distinct().collect(Collectors.toList());
+ // we should only fetch the latest merged file slices with committed data
+ return
table.getSliceView().getLatestMergedFileSlicesBeforeOrOn(partitionPath,
instantTime).filter(slice ->
!slice.isEmpty()).map(FileSlice::getFileId).distinct().collect(Collectors.toList());
Review Comment:
> In which case the file slice is empty?
When there is only one log file in this file group and this log file is
still in the pending state.
<img width="987" alt="image"
src="https://github.com/user-attachments/assets/2dd532a9-2c8f-4868-8f2b-22a405a61491"
/>
1. step1: fetch latest file slice which is filtered by
`HoodieFileGroup#isFileSliceCommitted`
<img width="1020" alt="image"
src="https://github.com/user-attachments/assets/75ae6e1e-0523-45a0-b020-616c2fbe70c4"
/>
`timeline.containsOrBeforeTimelineStarts(slice.getBaseInstantTime())` will
always return true because of `slice.getBaseInstantTime` will return
`HoodieActiveTimeline.INIT_INSTANT_TS`
So step-1 will get a flie-slice:`{base: empty, log: log-xxxx}`
2. step2: filter uncommitted log file by completion-time, so `log-xxxx` will
be filtered out, so the step-2 will get a flie-slice: `{base: empty, log:
empty}`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]