[
https://issues.apache.org/jira/browse/HBASE-20214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16402418#comment-16402418
]
BELUGA BEHR commented on HBASE-20214:
-------------------------------------
[https://github.com/apache/hbase/blob/93a182f286bb0a73dd1468d0b8df1cf1b8a6c098/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java]
{code}
protected List<ServerName> getTopBlockLocations(RegionInfo region, String
currentHost) {
HDFSBlocksDistribution blocksDistribution = getBlockDistribution(region);
List<String> topHosts = new ArrayList<>();
for (String host : blocksDistribution.getTopHosts()) {
if (host.equals(currentHost)) {
break;
}
topHosts.add(host);
}
return mapHostNameToServerName(topHosts);
}
{code}
Basically saying here... provide me a list of the first N hosts. Another way
to do this is to simply return a sublist instead of creating an entirely new
ArrayList, adding elements to it, having to grow the backing array, etc.
> Review of RegionLocationFinder Class
> ------------------------------------
>
> Key: HBASE-20214
> URL: https://issues.apache.org/jira/browse/HBASE-20214
> Project: HBase
> Issue Type: Improvement
> Components: Balancer, master
> Affects Versions: 2.0.0
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Minor
> Attachments: HBASE-20214.1.patch
>
>
> # Use SLF4J parameter logging
> # Remove superfluous code
> # Replace code with re-usable libraries where possible
> # Use different data structure
> # Small perf improvements
> # Fix some checkstyle
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)