bharatviswa504 commented on a change in pull request #2261:
URL: https://github.com/apache/ozone/pull/2261#discussion_r638680061



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
##########
@@ -2370,4 +2387,22 @@ void sortDatanodes(String clientMachine, OmKeyInfo... 
keyInfos) {
     }
     return nodeSet;
   }
+
+  private void slimLocationVersion(OmKeyInfo... keyInfos) {
+    if (keyInfos != null) {
+      for (OmKeyInfo keyInfo : keyInfos) {
+        OmKeyLocationInfoGroup key = keyInfo.getLatestVersionLocations();
+        if (key == null) {
+          LOG.warn("No location version for key {}", keyInfo);
+          continue;
+        }
+        int keyLocationVersionLength = keyInfo.getKeyLocationVersions().size();
+        if (keyLocationVersionLength <= 1) {
+          continue;
+        }
+        keyInfo.setKeyLocationVersions(keyInfo.getKeyLocationVersions()

Review comment:
       Not understood this code.
   
   Here We should return only latest blocks for the last version.
   
   Here, we are returning latestVersion which has blocks of version 0....n. 
Here should we return only the latest version blocks?
   

##########
File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java
##########
@@ -83,8 +82,6 @@
     // complete and prove correctly functioning
     long currentVersion = -1;
     for (OmKeyLocationInfoGroup version : versions) {

Review comment:
       After removing this, I don't think we need code lines from L83-L86

##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
##########
@@ -2370,4 +2387,22 @@ void sortDatanodes(String clientMachine, OmKeyInfo... 
keyInfos) {
     }
     return nodeSet;
   }
+
+  private void slimLocationVersion(OmKeyInfo... keyInfos) {
+    if (keyInfos != null) {
+      for (OmKeyInfo keyInfo : keyInfos) {
+        OmKeyLocationInfoGroup key = keyInfo.getLatestVersionLocations();
+        if (key == null) {
+          LOG.warn("No location version for key {}", keyInfo);
+          continue;
+        }
+        int keyLocationVersionLength = keyInfo.getKeyLocationVersions().size();
+        if (keyLocationVersionLength <= 1) {
+          continue;
+        }
+        keyInfo.setKeyLocationVersions(keyInfo.getKeyLocationVersions()

Review comment:
       And also if we want to return last Version of OmKeyLocationinfoGroup, 
can we return as below? instead of subList
   
   
`keyInfo.setKeyLocationVersions(keyInfo.getKeyLocationVersions().get(keyLocationVersionLength-1)`
   




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