chungen0126 commented on code in PR #11685:
URL: https://github.com/apache/ozone/pull/11685#discussion_r4366806370


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java:
##########
@@ -1167,14 +1171,38 @@ private KeyEntityInfo 
createKeyEntityInfoFromOmKeyInfo(String dbKey,
     keyEntityInfo.setIsKey(keyInfo.isFile());
     String fullKeyPath = ReconUtils.constructFullPath(keyInfo, 
reconNamespaceSummaryManager);
     keyEntityInfo.setPath(fullKeyPath.isEmpty() ? keyInfo.getKeyName() : 
fullKeyPath);
-    keyEntityInfo.setSize(keyInfo.getDataSize());
+    if (OMMultipartUploadUtils.isMultipartKeySet(keyInfo)) {
+      Pair<Long, Long> uploadSize = getMultipartUploadSize(dbKey, keyInfo);
+      keyEntityInfo.setSize(uploadSize.getLeft());
+      keyEntityInfo.setReplicatedSize(uploadSize.getRight());
+    } else {
+      keyEntityInfo.setSize(keyInfo.getDataSize());
+      keyEntityInfo.setReplicatedSize(keyInfo.getReplicatedSize());
+    }
     keyEntityInfo.setCreationTime(keyInfo.getCreationTime());
     keyEntityInfo.setModificationTime(keyInfo.getModificationTime());
-    keyEntityInfo.setReplicatedSize(keyInfo.getReplicatedSize());
     keyEntityInfo.setReplicationConfig(keyInfo.getReplicationConfig());
     return keyEntityInfo;
   }
 
+  /**
+   * Returns the (unreplicated, replicated) size of the committed parts of the 
multipart upload that a multipart
+   * open key belongs to, or zero if the upload can no longer be found.
+   */
+  private Pair<Long, Long> getMultipartUploadSize(String dbKey, OmKeyInfo 
keyInfo) throws IOException {

Review Comment:
   According to [HDDS-15942](https://issues.apache.org/jira/browse/HDDS-15942), 
please avoid using Pair.



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/MultipartInfoInsightHandler.java:
##########
@@ -332,6 +337,26 @@ private void applyPartSize(OmMultipartPartKey partKey, 
OmMultipartPartInfo partI
         "replicated");
   }
 
+  /**
+   * Returns the (unreplicated, replicated) size of the committed parts of a 
single MPU, read from the embedded
+   * parts for legacy-schema MPUs and from {@code multipartPartsTable} for 
split-schema MPUs.
+   */
+  public static Pair<Long, Long> getCommittedPartsSize(OmMultipartKeyInfo 
multipartKeyInfo,

Review Comment:
   According to [HDDS-15942](https://issues.apache.org/jira/browse/HDDS-15942), 
please avoid using Pair.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to