You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/06/25 05:24:38 UTC

[GitHub] [ozone] bharatviswa504 commented on a change in pull request #2367: HDDS-5384 OM refreshPipeline should not invoke the expensive OmKeyLocationInfoGroup.getLocationList()

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



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
##########
@@ -745,33 +745,34 @@ protected void refreshPipeline(List<OmKeyInfo> keyList) throws IOException {
     }
 
     Set<Long> containerIDs = new HashSet<>();
-    for (OmKeyInfo keyInfo : keyList) {
-      List<OmKeyLocationInfoGroup> locationInfoGroups =
-          keyInfo.getKeyLocationVersions();
-
-      for (OmKeyLocationInfoGroup key : locationInfoGroups) {
-        for (OmKeyLocationInfo k : key.getLocationList()) {
-          containerIDs.add(k.getContainerID());
-        }
-      }
-    }
+    keyList.forEach(
+        keyInfo -> keyInfo.getKeyLocationVersions().forEach(
+            key -> key.getLocationLists().forEach(
+                OmKeyLocationInfoList -> OmKeyLocationInfoList.forEach(
+                    k -> containerIDs.add(k.getContainerID())

Review comment:
       I see this is just using forEach instead of for, in addition to that with method usage.
   Just curious, any reason to change this way?




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org