You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ja...@apache.org on 2019/08/23 22:02:45 UTC

[hbase] branch master updated: HBASE-20509 putting List in HashSet directly without using addAll function to improve performance

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

janh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new f4ff480  HBASE-20509 putting List in HashSet directly without using addAll function to improve performance
f4ff480 is described below

commit f4ff480387bff40129aefb16e0379ca8062d4ca9
Author: Tai-Ying Lee <ta...@gmail.com>
AuthorDate: Mon Apr 30 13:49:54 2018 +0000

    HBASE-20509 putting List in HashSet directly without using addAll function to improve performance
    
    Signed-off-by: Jan Hentschel <ja...@ultratendency.com>
---
 .../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