TheR1sing3un commented on code in PR #13342:
URL: https://github.com/apache/hudi/pull/13342#discussion_r2104182907


##########
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).map(FileSlice::getFileId).distinct().collect(Collectors.toList());

Review Comment:
   The changes here are intended to achieve the following two points:
   1. only the view completed before this instant should be seen to ensure 
transactionality.
   2. we should select the file id of the file slice where the valid commit 
data actually exists as the replaced file id.



-- 
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]

Reply via email to