codope commented on a change in pull request #4693:
URL: https://github.com/apache/hudi/pull/4693#discussion_r835758046



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
##########
@@ -620,8 +636,14 @@ private void initializeFileGroups(HoodieTableMetaClient 
dataMetaClient, Metadata
 
     LOG.info(String.format("Creating %d file groups for partition %s with base 
fileId %s at instant time %s",
         fileGroupCount, metadataPartition.getPartitionPath(), 
metadataPartition.getFileIdPrefix(), instantTime));
+    HoodieTableFileSystemView fsView = 
HoodieTableMetadataUtil.getFileSystemView(metadataMetaClient);
+    List<FileSlice> fileSlices = 
HoodieTableMetadataUtil.getPartitionLatestFileSlices(metadataMetaClient, 
Option.ofNullable(fsView), metadataPartition.getPartitionPath());
     for (int i = 0; i < fileGroupCount; ++i) {
       final String fileGroupFileId = String.format("%s%04d", 
metadataPartition.getFileIdPrefix(), i);
+      // if a writer or async indexer had already initialized the filegroup 
then continue
+      if (!fileSlices.isEmpty() && fileSlices.stream().anyMatch(fileSlice -> 
fileGroupFileId.equals(fileSlice.getFileGroupId().getFileId()))) {
+        continue;

Review comment:
        Not handled currently.
   So, first we check whether a particular partition needs to be initialized or 
not. If yes, then initialize but in case of partial failed filegroup 
instantiation, we will clean up all file groups and start from scratch. Will 
add this logic.




-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to