Apache9 commented on a change in pull request #3682:
URL: https://github.com/apache/hbase/pull/3682#discussion_r708770612
##########
File path:
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BalancerClusterState.java
##########
@@ -368,12 +373,10 @@ public String getRack(ServerName server) {
int region = regionsPerServer[serversPerHost[i][j]][k];
regionsPerHost[i][numRegionPerHostIndex] = region;
int primaryIndex = regionIndexToPrimaryIndex[region];
- primariesOfRegionsPerHost[i][numRegionPerHostIndex] = primaryIndex;
+ primariesOfRegionsPerHost[i].getAndIncrement(primaryIndex);
Review comment:
Ditto?
##########
File path:
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BalancerClusterState.java
##########
@@ -395,12 +399,10 @@ public String getRack(ServerName server) {
int region = regionsPerServer[serversPerRack[i][j]][k];
regionsPerRack[i][numRegionPerRackIndex] = region;
int primaryIndex = regionIndexToPrimaryIndex[region];
- primariesOfRegionsPerRack[i][numRegionPerRackIndex] = primaryIndex;
+ primariesOfRegionsPerRack[i].getAndIncrement(primaryIndex);
Review comment:
Ditto?
##########
File path:
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BalancerClusterState.java
##########
@@ -342,13 +347,12 @@ public String getRack(ServerName server) {
}
for (int i = 0; i < regionsPerServer.length; i++) {
- primariesOfRegionsPerServer[i] = new int[regionsPerServer[i].length];
+ primariesOfRegionsPerServer[i] = new Int2IntCounterMap(
+ regionsPerServer[i].length, Hashing.DEFAULT_LOAD_FACTOR, 0);
for (int j = 0; j < regionsPerServer[i].length; j++) {
int primaryIndex = regionIndexToPrimaryIndex[regionsPerServer[i][j]];
- primariesOfRegionsPerServer[i][j] = primaryIndex;
+ primariesOfRegionsPerServer[i].getAndIncrement(primaryIndex);
Review comment:
Better rename the primariesOfRegionsPerServer to a name with something
like count or counter in it? I think in the past we record the primaryIndex for
all the regions on this region server but now, we just record the number of
region replicas for a primary region on this region server?
--
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]