You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/02/03 00:10:07 UTC

[GitHub] [hudi] alexeykudinkin commented on a change in pull request #4739: [HUDI-3365] Make sure Metadata Table records are updated appropriately on HDFS

alexeykudinkin commented on a change in pull request #4739:
URL: https://github.com/apache/hudi/pull/4739#discussion_r798116440



##########
File path: hudi-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataPayload.java
##########
@@ -215,19 +215,16 @@ public HoodieMetadataPayload preCombine(HoodieMetadataPayload previousRecord) {
 
     if (filesystemMetadata != null) {
       filesystemMetadata.forEach((filename, fileInfo) -> {
-        // If the filename wasnt present then we carry it forward
-        if (!combinedFileInfo.containsKey(filename)) {
-          combinedFileInfo.put(filename, fileInfo);
+        if (fileInfo.getIsDeleted()) {
+          combinedFileInfo.remove(filename);
         } else {
-          if (fileInfo.getIsDeleted()) {
-            // file deletion
-            combinedFileInfo.remove(filename);
-          } else {
-            // file appends.
-            combinedFileInfo.merge(filename, fileInfo, (oldFileInfo, newFileInfo) -> {
-              return new HoodieMetadataFileInfo(oldFileInfo.getSize() + newFileInfo.getSize(), false);
-            });
-          }
+          // NOTE: There are 2 possible cases here:
+          //    - New file is created: in that case we're simply adding its info
+          //    - File is appended to (only log-files of MOR tables on supported FS): in that case
+          //      we simply pick the info w/ largest file-size as the most recent one, since file's
+          //      sizes are increasing monotonically (meaning that the larger file-size is more recent one)
+          combinedFileInfo.merge(filename, fileInfo, (oldFileInfo, newFileInfo) ->

Review comment:
       Correct




-- 
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-unsubscribe@hudi.apache.org

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