clarax commented on a change in pull request #3575:
URL: https://github.com/apache/hbase/pull/3575#discussion_r686561925
##########
File path:
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CandidateGenerator.java
##########
@@ -42,13 +42,13 @@
*/
int pickRandomRegion(BalancerClusterState cluster, int server, double
chanceOfNoSwap) {
// Check to see if this is just a move.
- if (cluster.regionsPerServer[server].length == 0
+ if (cluster.regionsPerServer.get(server).size() == 0
|| ThreadLocalRandom.current().nextFloat() < chanceOfNoSwap) {
// signal a move only.
return -1;
}
- int rand =
ThreadLocalRandom.current().nextInt(cluster.regionsPerServer[server].length);
- return cluster.regionsPerServer[server][rand];
+ int rand =
ThreadLocalRandom.current().nextInt(cluster.regionsPerServer.get(server).size());
+ return cluster.regionsPerServer.get(server).get(rand);
Review comment:
I have to keep RegionsPerServer as ArrayList<ArrayList<Integer>> because
we need to get random element while making it compatible with
regionsPerHost/Rack.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]