diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java index 15dedc6888d..6a618e12109 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java @@ -40,10 +40,6 @@ import org.apache.hadoop.hbase.TableName; *

Cluster-wide load balancing will occur only when there are no regions in * transition and according to a fixed period of a time using {@link #balanceCluster(Map)}. * - *

Inline region placement with {@link #immediateAssignment} can be used when - * the Master needs to handle closed regions that it currently does not have - * a destination set for. This can happen during master failover. - * *

On cluster startup, bulk assignment can be used to determine * locations for all Regions in a cluster. * @@ -105,17 +101,6 @@ public interface LoadBalancer extends Configurable, Stoppable, ConfigurationObse List servers ) throws HBaseIOException; - /** - * Sync assign a region - * @param regions - * @param servers - * @return Map regioninfos to servernames - */ - Map immediateAssignment( - List regions, - List servers - ) throws HBaseIOException; - /** * Get a random region server from the list * @param regionInfo Region for which this selection is being done. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java index 44e1f799fd3..bde5c61d34c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java @@ -81,16 +81,16 @@ public abstract class BaseLoadBalancer implements LoadBalancer { return UNKNOWN_RACK; } } - + /** * The constructor that uses the basic MetricsBalancer */ protected BaseLoadBalancer() { metricsBalancer = new MetricsBalancer(); } - + /** - * This Constructor accepts an instance of MetricsBalancer, + * This Constructor accepts an instance of MetricsBalancer, * which will be used instead of creating a new one */ protected BaseLoadBalancer(MetricsBalancer metricsBalancer) { @@ -1278,39 +1278,6 @@ public abstract class BaseLoadBalancer implements LoadBalancer { rackManager); } - /** - * Generates an immediate assignment plan to be used by a new master for - * regions in transition that do not have an already known destination. - * - * Takes a list of regions that need immediate assignment and a list of all - * available servers. Returns a map of regions to the server they should be - * assigned to. - * - * This method will return quickly and does not do any intelligent balancing. - * The goal is to make a fast decision not the best decision possible. - * - * Currently this is random. - * - * @param regions - * @param servers - * @return map of regions to the server it should be assigned to - */ - @Override - public Map immediateAssignment(List regions, - List servers) { - metricsBalancer.incrMiscInvocations(); - if (servers == null || servers.isEmpty()) { - LOG.warn("Wanted to do random assignment but no servers to assign to"); - return null; - } - - Map assignments = new TreeMap(); - for (HRegionInfo region : regions) { - assignments.put(region, randomAssignment(region, servers)); - } - return assignments; - } - /** * Used to assign a single region to a random server. */ diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java index 43255859439..fdcedf1d1aa 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java @@ -46,14 +46,10 @@ import com.google.common.collect.MinMaxPriorityQueue; *

Cluster-wide load balancing will occur only when there are no regions in * transition and according to a fixed period of a time using {@link #balanceCluster(Map)}. * - *

Inline region placement with {@link #immediateAssignment} can be used when - * the Master needs to handle closed regions that it currently does not have - * a destination set for. This can happen during master failover. - * *

On cluster startup, bulk assignment can be used to determine * locations for all Regions in a cluster. * - *

This classes produces plans for the + *

This classes produces plans for the * {@link org.apache.hadoop.hbase.master.AssignmentManager} to execute. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java index 205fbea689a..45d9fe5a72f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java @@ -117,38 +117,6 @@ public class TestBaseLoadBalancer extends BalancerTestBase { } - /** - * Tests immediate assignment. - * - * Invariant is that all regions have an assignment. - * - * @throws Exception - */ - @Test (timeout=30000) - public void testImmediateAssignment() throws Exception { - List tmp = getListOfServerNames(randomServers(1, 0)); - tmp.add(master); - ServerName sn = loadBalancer.randomAssignment(HRegionInfo.FIRST_META_REGIONINFO, tmp); - assertEquals(master, sn); - HRegionInfo hri = randomRegions(1, -1).get(0); - sn = loadBalancer.randomAssignment(hri, tmp); - assertNotEquals(master, sn); - tmp = new ArrayList(); - tmp.add(master); - sn = loadBalancer.randomAssignment(hri, tmp); - assertNull("Should not assign user regions on master", sn); - for (int[] mock : regionsAndServersMocks) { - LOG.debug("testImmediateAssignment with " + mock[0] + " regions and " + mock[1] + " servers"); - List regions = randomRegions(mock[0]); - List servers = randomServers(mock[1], 0); - List list = getListOfServerNames(servers); - Map assignments = loadBalancer.immediateAssignment(regions, list); - assertImmediateAssignment(regions, list, assignments); - returnRegions(regions); - returnServers(list); - } - } - /** * All regions have an assignment. * @param regions