kaijchen commented on code in PR #3778:
URL: https://github.com/apache/ozone/pull/3778#discussion_r1000557610


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java:
##########
@@ -207,50 +211,65 @@ public void 
updateLocationInfoList(List<OmKeyLocationInfo> locationInfoList,
 
     // Compare user given block location against allocatedBlockLocations
     // present in OmKeyInfo.
+    List<OmKeyLocationInfo> uncommittedBlocks = new ArrayList<>();
     List<OmKeyLocationInfo> updatedBlockLocations;
     if (skipBlockIDCheck) {
       updatedBlockLocations = locationInfoList;
     } else {
-      updatedBlockLocations =
-          verifyAndGetKeyLocations(locationInfoList, keyLocationInfoGroup);
-    }
-    // Updates the latest locationList in the latest version only with
-    // given locationInfoList here.
-    // TODO : The original allocated list and the updated list here may vary
-    // as the containers on the Datanode on which the blocks were pre allocated
-    // might get closed. The diff of blocks between these two lists here
-    // need to be garbage collected in case the ozone client dies.
+      updatedBlockLocations = verifyAndGetKeyLocations(locationInfoList,
+          keyLocationInfoGroup, uncommittedBlocks);
+    }
+
     keyLocationInfoGroup.removeBlocks(latestVersion);
     // set each of the locationInfo object to the latest version
     updatedBlockLocations.forEach(omKeyLocationInfo -> omKeyLocationInfo
         .setCreateVersion(latestVersion));
     keyLocationInfoGroup.addAll(latestVersion, updatedBlockLocations);
+
+    return uncommittedBlocks;
   }
 
+  /**
+   *  1. Verify committed KeyLocationInfos
+   *  2. find out the allocated but uncommitted KeyLocationInfos.
+   *
+   * @param locationInfoList committed KeyLocationInfos
+   * @param keyLocationInfoGroup allocated KeyLocationInfoGroup
+   * @param uncommittedLocationInfos list of uncommitted KeyLocationInfos

Review Comment:
   Javadoc for `uncommittedLocationInfos` should reflect it's a field being 
written to.
   For example `a List where the uncommitted KeyLocationInfos will be added 
into`.



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