hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [07/22] hbase git commit: HBASE-15239 Remove unused LoadBalancer.immediateAssignment()
Date Sat, 13 Feb 2016 20:10:18 GMT
HBASE-15239 Remove unused LoadBalancer.immediateAssignment()


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d5331816
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d5331816
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d5331816

Branch: refs/heads/hbase-12439
Commit: d53318163be54ff8b0eff44402fdf5b16a233100
Parents: df829ea
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Wed Feb 10 09:16:42 2016 -0800
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Wed Feb 10 09:16:42 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/LoadBalancer.java       | 15 --------
 .../hbase/master/balancer/BaseLoadBalancer.java | 39 ++------------------
 .../master/balancer/SimpleLoadBalancer.java     |  6 +--
 .../master/balancer/TestBaseLoadBalancer.java   | 32 ----------------
 4 files changed, 4 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d5331816/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java
----------------------------------------------------------------------
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 15dedc6..6a618e1 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;
  * <p>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)}.
  *
- * <p>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.
- *
  * <p>On cluster startup, bulk assignment can be used to determine
  * locations for all Regions in a cluster.
  *
@@ -106,17 +102,6 @@ public interface LoadBalancer extends Configurable, Stoppable, ConfigurationObse
   ) throws HBaseIOException;
 
   /**
-   * Sync assign a region
-   * @param regions
-   * @param servers
-    * @return Map regioninfos to servernames
-   */
-  Map<HRegionInfo, ServerName> immediateAssignment(
-    List<HRegionInfo> regions,
-    List<ServerName> servers
-  ) throws HBaseIOException;
-
-  /**
    * Get a random region server from the list
    * @param regionInfo Region for which this selection is being done.
    * @param servers

http://git-wip-us.apache.org/repos/asf/hbase/blob/d5331816/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
----------------------------------------------------------------------
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 44e1f79..bde5c61 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) {
@@ -1279,39 +1279,6 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   }
 
   /**
-   * 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<HRegionInfo, ServerName> immediateAssignment(List<HRegionInfo> regions,
-      List<ServerName> servers) {
-    metricsBalancer.incrMiscInvocations();
-    if (servers == null || servers.isEmpty()) {
-      LOG.warn("Wanted to do random assignment but no servers to assign to");
-      return null;
-    }
-
-    Map<HRegionInfo, ServerName> assignments = new TreeMap<HRegionInfo, ServerName>();
-    for (HRegionInfo region : regions) {
-      assignments.put(region, randomAssignment(region, servers));
-    }
-    return assignments;
-  }
-
-  /**
    * Used to assign a single region to a random server.
    */
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/d5331816/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java
----------------------------------------------------------------------
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 4325585..fdcedf1 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;
  * <p>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)}.
  *
- * <p>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.
- *
  * <p>On cluster startup, bulk assignment can be used to determine
  * locations for all Regions in a cluster.
  *
- * <p>This classes produces plans for the 
+ * <p>This classes produces plans for the
  * {@link org.apache.hadoop.hbase.master.AssignmentManager} to execute.
  */
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)

http://git-wip-us.apache.org/repos/asf/hbase/blob/d5331816/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java
----------------------------------------------------------------------
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 205fbea..45d9fe5 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
@@ -118,38 +118,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<ServerName> 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<ServerName>();
-    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<HRegionInfo> regions = randomRegions(mock[0]);
-      List<ServerAndLoad> servers = randomServers(mock[1], 0);
-      List<ServerName> list = getListOfServerNames(servers);
-      Map<HRegionInfo, ServerName> assignments = loadBalancer.immediateAssignment(regions,
list);
-      assertImmediateAssignment(regions, list, assignments);
-      returnRegions(regions);
-      returnServers(list);
-    }
-  }
-
-  /**
    * All regions have an assignment.
    * @param regions
    * @param servers


Mime
View raw message