clarax commented on a change in pull request #3575:
URL: https://github.com/apache/hbase/pull/3575#discussion_r686549189
##########
File path:
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BalancerClusterState.java
##########
@@ -699,102 +684,57 @@ void regionMoved(int region, int oldServer, int
newServer) {
// update for servers
int primary = regionIndexToPrimaryIndex[region];
if (oldServer >= 0) {
- primariesOfRegionsPerServer[oldServer] =
- removeRegion(primariesOfRegionsPerServer[oldServer], primary);
+ removeElement(primariesOfRegionsPerServer.get(oldServer), primary,
region);
}
- primariesOfRegionsPerServer[newServer] =
- addRegionSorted(primariesOfRegionsPerServer[newServer], primary);
+ addElement(primariesOfRegionsPerServer.get(newServer), primary, region);
Review comment:
O(n)->O(1) for adding an element by its value. The old implementation
takes an array copy.
--
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]