hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-16087 Replication shouldn't start on a master if if only hosts system tables
Date Tue, 05 Jul 2016 20:52:39 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 20a99b4c0 -> ae92668dd


HBASE-16087 Replication shouldn't start on a master if if only hosts system tables


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

Branch: refs/heads/master
Commit: ae92668dd6eff5271ceeecc435165f5fc14fab48
Parents: 20a99b4
Author: Elliott Clark <eclark@apache.org>
Authored: Wed Jun 22 15:40:28 2016 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Tue Jul 5 13:50:37 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/balancer/BaseLoadBalancer.java | 13 +++++++++++++
 .../hadoop/hbase/regionserver/HRegionServer.java       |  6 ++++++
 2 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ae92668d/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 f52dbdf..dc5bace 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
@@ -1016,6 +1016,19 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     return tables != null && tables.length > 0;
   }
 
+  public static boolean userTablesOnMaster(Configuration conf) {
+    String[] tables = getTablesOnMaster(conf);
+    if (tables == null || tables.length == 0) {
+      return false;
+    }
+    for (String tn:tables) {
+      if (!tn.startsWith("hbase:")) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   @Override
   public void setConf(Configuration conf) {
     setSlop(conf);

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae92668d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 1c1000e..877c3db 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -118,6 +118,7 @@ import org.apache.hadoop.hbase.ipc.ServerRpcController;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.RegionState.State;
 import org.apache.hadoop.hbase.master.TableLockManager;
+import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer;
 import org.apache.hadoop.hbase.mob.MobCacheConfig;
 import org.apache.hadoop.hbase.procedure.RegionServerProcedureManagerHost;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
@@ -2651,6 +2652,11 @@ public class HRegionServer extends HasThread implements
   static private void createNewReplicationInstance(Configuration conf,
     HRegionServer server, FileSystem fs, Path logDir, Path oldLogDir) throws IOException{
 
+    if ((server instanceof HMaster) &&
+        (!BaseLoadBalancer.userTablesOnMaster(conf))) {
+      return;
+    }
+
     // read in the name of the source replication class from the config file.
     String sourceClassname = conf.get(HConstants.REPLICATION_SOURCE_SERVICE_CLASSNAME,
                                HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT);


Mime
View raw message