juncevich commented on code in PR #7558:
URL: https://github.com/apache/ozone/pull/7558#discussion_r1908234798


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -509,6 +509,33 @@ private OmKeyInfo readKeyInfo(OmKeyArgs args, BucketLayout 
bucketLayout)
     if (args.getLatestVersionLocation()) {
       slimLocationVersion(value);
     }
+    int partNumberParam = args.getMultipartUploadPartNumber();
+    if (partNumberParam > 0) {
+      OmKeyLocationInfoGroup latestLocationVersion = 
value.getLatestVersionLocations();
+      if (latestLocationVersion != null && 
latestLocationVersion.isMultipartKey()) {
+        List<OmKeyLocationInfo> currentLocations =
+            
value.getKeyLocationVersions().get(value.getKeyLocationVersions().size() - 1)
+                .getLocationList()
+                .stream()
+                .filter(it -> it.getPartNumber() == partNumberParam)
+                .collect(Collectors.toList());
+
+        value.setKeyLocationVersions(
+            Collections.singletonList(
+                new OmKeyLocationInfoGroup(
+                    latestLocationVersion.getVersion(),
+                    currentLocations,
+                    true
+                )
+            )
+        );
+
+        long dataLength = currentLocations.stream()
+            .mapToLong(BlockLocationInfo::getLength)
+            .sum();
+        value.setDataSize(dataLength);

Review Comment:
   Whoa! This is much better. I missed the `updateLocationInfoList` method. 
Thanks!



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