hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/4] hbase git commit: HBASE-18478 Allow users to remove RegionFinder from LoadBalancer calculations if no locality possible
Date Wed, 20 Sep 2017 00:35:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 2845ddaf9 -> bafc6e523
  refs/heads/branch-1.4 d4aa7181c -> cfbbcf5c1
  refs/heads/branch-2 518674bce -> d0a54352e
  refs/heads/master bc790fe26 -> 830173459


HBASE-18478 Allow users to remove RegionFinder from LoadBalancer calculations if no locality
possible

This provides significant cluster start time reduction for FileSystems which do not surface
locality (S3).

Signed-off-by: Andrew Purtell <apurtell@apache.org>

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java


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

Branch: refs/heads/branch-1
Commit: bafc6e523efba67b5829d2095500c134df1ae4ce
Parents: 2845dda
Author: Zach York <zyork@amazon.com>
Authored: Thu Jun 22 14:12:49 2017 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Tue Sep 19 16:30:43 2017 -0700

----------------------------------------------------------------------
 .../hbase/master/balancer/BaseLoadBalancer.java | 29 ++++++++++++++++----
 1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/bafc6e52/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 f96f0eb..97a4cb1 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
@@ -39,6 +39,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterStatus;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseIOException;
 import org.apache.hadoop.hbase.HDFSBlocksDistribution;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -71,7 +72,8 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
   private static final List<HRegionInfo> EMPTY_REGION_LIST = new ArrayList<HRegionInfo>(0);
 
-  protected final RegionLocationFinder regionFinder = new RegionLocationFinder();
+  protected RegionLocationFinder regionFinder;
+  protected boolean useRegionFinder;
 
   private static class DefaultRackManager extends RackManager {
     @Override
@@ -85,6 +87,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    */
   protected BaseLoadBalancer() {
     metricsBalancer = new MetricsBalancer();
+    createRegionFinder();
   }
 
   /**
@@ -93,6 +96,14 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    */
   protected BaseLoadBalancer(MetricsBalancer metricsBalancer) {
     this.metricsBalancer = (metricsBalancer != null) ? metricsBalancer : new MetricsBalancer();
+    createRegionFinder();
+  }
+
+  private void createRegionFinder() {
+    useRegionFinder = config.getBoolean("hbase.master.balancer.uselocality", true);
+    if (useRegionFinder) {
+      regionFinder = new RegionLocationFinder();
+    }
   }
 
   /**
@@ -1085,7 +1096,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
   // slop for regions
   protected float slop;
-  protected Configuration config;
+  protected Configuration config = HBaseConfiguration.create();
   protected RackManager rackManager;
   private static final Random RANDOM = new Random(System.currentTimeMillis());
   private static final Log LOG = LogFactory.getLog(BaseLoadBalancer.class);
@@ -1145,7 +1156,9 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
       Collections.addAll(tablesOnMaster, tables);
     }
     this.rackManager = new RackManager(getConf());
-    regionFinder.setConf(conf);
+    if (useRegionFinder) {
+      regionFinder.setConf(conf);
+    }
   }
 
   protected void setSlop(Configuration conf) {
@@ -1240,14 +1253,18 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   @Override
   public synchronized void setClusterStatus(ClusterStatus st) {
     this.clusterStatus = st;
-    regionFinder.setClusterStatus(st);
+    if (useRegionFinder) {
+      regionFinder.setClusterStatus(st);
+    }
   }
 
   @Override
   public void setMasterServices(MasterServices masterServices) {
     masterServerName = masterServices.getServerName();
     this.services = masterServices;
-    this.regionFinder.setServices(masterServices);
+    if (useRegionFinder) {
+      this.regionFinder.setServices(masterServices);
+    }
   }
 
   public void setRackManager(RackManager rackManager) {
@@ -1398,7 +1415,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
   protected Cluster createCluster(List<ServerName> servers,
       Collection<HRegionInfo> regions, boolean forceRefresh) {
-    if (forceRefresh == true) {
+    if (forceRefresh && useRegionFinder) {
       regionFinder.refreshAndWait(regions);
     }
     // Get the snapshot of the current assignments for the regions in question, and then
create


Mime
View raw message