Review board is down again. Attaching v0 patch here instead.
This patch builds on top of
HBASE-10350, and includes changes from Devaraj Das and myself for load balancer to enforce region replica placement.
HBASE-10350 enables table creation with region replicas, but won't have any region placement enforcement. This patch, adds co-location constraints to the LB, so that it does a best effort job to not place replicas of the same region in same hosts / racks.
The overview of changes are:
- BaseLoadBalancer.Cluster is aware of hosts and racks for servers
- BaseLoadBalancer.Cluster is aware of regions per host / rack
- BaseLoadBalancer.Cluster keeps track of region replicas for co-location enforcement
- BaseLoadBalancer.Cluster can be constructed with unassigned regions as well. Some refactoring (Action, etc) for better abstractions etc.
- BaseLoadBalancer.retainAssignments(), etc now construct a Cluster object and use the methods there to ensure co-location constraint. This is a first step in unifying the way we do balance() and table creation, retainAssignment() etc. We can continue with this in other jiras (not part of HBASE-10070).
- StochasticLoadBalancer has (high) costs for host/rack replica co-locations and candidate generator for ensuring optimum plan generation. By the way of these cost functions, the LB can satisfy that replicas are not co-located as long as there are enough servers / rack left. If not, it will still do assignment (soft constraint)
- Bunch of tests to ensure region placement (and speed of balance() run)