This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ceeca92  HDDS-4201. Improve the performance of OmKeyLocationInfoGroup 
(#1381)
ceeca92 is described below

commit ceeca92d1e846c33c27325c3797d3cf1352859c9
Author: runzhiwang <[email protected]>
AuthorDate: Fri Sep 4 14:42:01 2020 +0800

    HDDS-4201. Improve the performance of OmKeyLocationInfoGroup (#1381)
---
 .../apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
index abaf055..08bc8b2 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyLocationInfoGroup.java
@@ -36,8 +36,12 @@ public class OmKeyLocationInfoGroup {
   public OmKeyLocationInfoGroup(long version,
                                 List<OmKeyLocationInfo> locations) {
     this.version = version;
-    this.locationVersionMap = locations.stream()
-        .collect(Collectors.groupingBy(OmKeyLocationInfo::getCreateVersion));
+    locationVersionMap = new HashMap<>();
+    for (OmKeyLocationInfo info : locations) {
+      locationVersionMap
+          .computeIfAbsent(info.getCreateVersion(), v -> new ArrayList<>())
+          .add(info);
+    }
     //prevent NPE
     this.locationVersionMap.putIfAbsent(version, new ArrayList<>());
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to