[ https://issues.apache.org/jira/browse/HBASE-20737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513495#comment-16513495 ]
Chia-Ping Tsai commented on HBASE-20737: ---------------------------------------- There are something strange in the patch. {code:java} +From e30decc60eef5f4dfaabb3a1d8a44b6d433cb921 Mon Sep 17 00:00:00 2001 +From: Tai-Ying Lee <taiyn...@gmail.com> +Date: Mon, 30 Apr 2018 13:49:54 +0000 +Subject: [PATCH] HBASE-20509 putting List in HashSet directly without using + addAll function to improve performance + +--- + .../apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java +index a1fde74..a754c6b 100644 +--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java ++++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java +@@ -395,8 +395,7 @@ public class FavoredNodeAssignmentHelper { + rackSkipSet.add(primaryRack); + String secondaryRack = getOneRandomRack(rackSkipSet); + List<ServerName> serverList = getServersFromRack(secondaryRack); +- Set<ServerName> serverSet = new HashSet<>(); +- serverSet.addAll(serverList); ++ Set<ServerName> serverSet = new HashSet<>(serverList); + ServerName[] favoredNodes; + if (serverList.size() >= 2) { + // Randomly pick up two servers from this secondary rack +@@ -433,8 +432,7 @@ public class FavoredNodeAssignmentHelper { + } + secondaryRack = getOneRandomRack(rackSkipSet); + serverList = getServersFromRack(secondaryRack); +- serverSet = new HashSet<>(); +- serverSet.addAll(serverList); ++ serverSet = new HashSet<>(serverList); + } + + // Place the secondary RS +-- +2.7.4{code} > put collection into ArrayList instead of addAll function > -------------------------------------------------------- > > Key: HBASE-20737 > URL: https://issues.apache.org/jira/browse/HBASE-20737 > Project: HBase > Issue Type: Improvement > Affects Versions: 3.0.0 > Reporter: taiyinglee > Assignee: taiyinglee > Priority: Trivial > Attachments: HBASE-20737.v0.patch > > > [https://docs.oracle.com/javase/7/docs/api/java/util/Collection.html] > [https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html] > [https://docs.oracle.com/javase/7/docs/api/java/util/Set.html] > > /hbase/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java > change > List<Map.Entry<ServerName, Integer>> entries = new ArrayList<>(); > entries.addAll(lastSent.entrySet()); > to > List<Map.Entry<ServerName, Integer>> entries = new > ArrayList<>(lastSent.entrySet()); -- This message was sent by Atlassian JIRA (v7.6.3#76005)