zhaoyudi-creator commented on code in PR #19951:
URL: https://github.com/apache/hudi/pull/19951#discussion_r4023306151


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/bucket/BucketStreamWriteFunction.java:
##########
@@ -189,6 +196,10 @@ private void bootstrapIndexIfNeed(String partition) {
     log.info("Loading Hoodie Table {}, with path {}/{}", 
this.metaClient.getTableConfig().getTableName(),
         this.metaClient.getBasePath(), partition);
 
+    // Query the coordinator for pending fileIds before loading the committed 
view.
+    // Only needed after a restore.
+    Set<String> pendingFileIds = restoredFromState ? 
requestPendingBucketFileIds(partition) : Collections.emptySet();
+
     // Load existing fileID belongs to this task
     Map<Integer, String> bucketToFileIDMap = new HashMap<>();
     
this.writeClient.getHoodieTable().getHoodieView().getLatestFileSlices(partition).forEach(fileSlice
 -> {

Review Comment:
   getLatestFileSlicesIncludingInflight should still miss the inflight fileId 
when the metadata table is enabled. With metadata.enabled=true (the Flink 
default), the view's file groups are built from the MDT FILES-partition listing 
(FileSystemViewManager#getTableMetadata → 
AbstractTableFileSystemView#ensurePartitionLoadedCorrectly → 
BaseTableMetadata#fetchAllFilesInPartition), which only reflects committed 
files. Since the inflight instant has no MDT record yet, its file isn't in any 
file group, and getLatestFileSlicesIncludingInflight — which only drops the 
committed filter — can't surface it. 



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