From f4977da485eb200061d0b3ad9c2ab92c6da4d15e Mon Sep 17 00:00:00 2001 From: taiynlee Date: Fri, 15 Jun 2018 07:26:06 +0000 Subject: [PATCH] HBASE-20737 put collection into ArrayList instead of addAll function --- .../hbase/master/ClusterStatusPublisher.java | 3 +- ...-putting-List-in-HashSet-directly-without.patch | 37 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 patchoutput/0001-HBASE-20509-putting-List-in-HashSet-directly-without.patch diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java index 21fa263..af35ce4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java @@ -187,8 +187,7 @@ public class ClusterStatusPublisher extends ScheduledChore { } // We're sending the new deads first. - List> entries = new ArrayList<>(); - entries.addAll(lastSent.entrySet()); + List> entries = new ArrayList<>(lastSent.entrySet()); Collections.sort(entries, new Comparator>() { @Override public int compare(Map.Entry o1, Map.Entry o2) { diff --git a/patchoutput/0001-HBASE-20509-putting-List-in-HashSet-directly-without.patch b/patchoutput/0001-HBASE-20509-putting-List-in-HashSet-directly-without.patch new file mode 100644 index 0000000..d24b536 --- /dev/null +++ b/patchoutput/0001-HBASE-20509-putting-List-in-HashSet-directly-without.patch @@ -0,0 +1,37 @@ +From e30decc60eef5f4dfaabb3a1d8a44b6d433cb921 Mon Sep 17 00:00:00 2001 +From: Tai-Ying Lee +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 serverList = getServersFromRack(secondaryRack); +- Set serverSet = new HashSet<>(); +- serverSet.addAll(serverList); ++ Set 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 + -- 2.7.4