ChenSammi commented on a change in pull request #1783:
URL: https://github.com/apache/ozone/pull/1783#discussion_r556291581



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java
##########
@@ -179,6 +174,20 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
         throw new OMException("Failed to commit key, as " + dbOpenKey +
             "entry is not found in the OpenKey table", KEY_NOT_FOUND);
       }
+
+      List<OmKeyLocationInfo> locationInfoList = new ArrayList<>();
+      long allocatedSize = 0;
+      long blockStorageSize = ozoneManager.getScmBlockSize() *
+          omKeyInfo.getFactor().getNumber();
+      for (KeyLocation keyLocation : commitKeyArgs.getKeyLocationsList()) {
+        OmKeyLocationInfo locationInfo =
+            OmKeyLocationInfo.getFromProtobuf(keyLocation);
+        if (locationInfo.getLength() > 0) {
+          locationInfoList.add(OmKeyLocationInfo.getFromProtobuf(keyLocation));
+        }
+        allocatedSize += blockStorageSize;
+      }

Review comment:
       @captainzmc ,  I got your point.  But the key point is we should not 
persist zero 0 location Info to OM DB and need to filter it out.  Following is 
the code. 
   
   if (locationInfo.getLength() > 0) {
             
locationInfoList.add(OmKeyLocationInfo.getFromProtobuf(keyLocation));
   }




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