elek commented on a change in pull request #2108:
URL: https://github.com/apache/ozone/pull/2108#discussion_r616636826



##########
File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
##########
@@ -159,13 +184,40 @@ public void 
updateLocationInfoList(List<OmKeyLocationInfo> locationInfoList,
     // need to be garbage collected in case the ozone client dies.
     keyLocationInfoGroup.removeBlocks(latestVersion);
     // set each of the locationInfo object to the latest version
-    locationInfoList.forEach(omKeyLocationInfo -> omKeyLocationInfo
+    updatedBlockLocations.forEach(omKeyLocationInfo -> omKeyLocationInfo
         .setCreateVersion(latestVersion));
-    keyLocationInfoGroup.addAll(latestVersion, locationInfoList);
+    keyLocationInfoGroup.addAll(latestVersion, updatedBlockLocations);
+  }
+
+  private List<OmKeyLocationInfo> verifyAndGetKeyLocations(
+      List<OmKeyLocationInfo> locationInfoList,
+      OmKeyLocationInfoGroup keyLocationInfoGroup) {
+
+    List<OmKeyLocationInfo> allocatedBlockLocations =
+        keyLocationInfoGroup.getBlocksLatestVersionOnly();
+    List<OmKeyLocationInfo> updatedBlockLocations = new ArrayList<>();
+
+    for (OmKeyLocationInfo modifiedLocationInfo : locationInfoList) {
+      boolean unKnownBlockID = true;
+      BlockID modifiedBlockID = modifiedLocationInfo.getBlockID();
+      for (OmKeyLocationInfo existingLocationInfo : allocatedBlockLocations) {
+        BlockID existingBlockID = existingLocationInfo.getBlockID();
+        if (modifiedBlockID.getContainerBlockID()
+            .equals(existingBlockID.getContainerBlockID())) {
+          updatedBlockLocations.add(modifiedLocationInfo);
+          unKnownBlockID = false;
+          break;
+        }
+      }
+      if (unKnownBlockID) {
+        LOG.warn("UnKnown BlockLocation:{}, where the blockID of given "

Review comment:
       ```suggestion
           LOG.warn("Unknown BlockLocation:{}, where the blockID of given "
   ```




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

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