HBASE-20509 putting List in HashSet directly without using addAll function to improve performance

Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
This commit is contained in:
Tai-Ying Lee 2018-04-30 13:49:54 +00:00 committed by Jan Hentschel
parent 43f53c1a23
commit f4ff480387
No known key found for this signature in database
GPG Key ID: 5CD818B19CC299A3
1 changed files with 2 additions and 4 deletions

View File

@ -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