HBASE-16087 Replication shouldn't start on a master if if only hosts system tables
This commit is contained in:
parent
20a99b4c06
commit
ae92668dd6
@ -1016,6 +1016,19 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
|
|||||||
return tables != null && tables.length > 0;
|
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
|
@Override
|
||||||
public void setConf(Configuration conf) {
|
public void setConf(Configuration conf) {
|
||||||
setSlop(conf);
|
setSlop(conf);
|
||||||
|
@ -118,6 +118,7 @@ import org.apache.hadoop.hbase.ipc.ServerRpcController;
|
|||||||
import org.apache.hadoop.hbase.master.HMaster;
|
import org.apache.hadoop.hbase.master.HMaster;
|
||||||
import org.apache.hadoop.hbase.master.RegionState.State;
|
import org.apache.hadoop.hbase.master.RegionState.State;
|
||||||
import org.apache.hadoop.hbase.master.TableLockManager;
|
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.mob.MobCacheConfig;
|
||||||
import org.apache.hadoop.hbase.procedure.RegionServerProcedureManagerHost;
|
import org.apache.hadoop.hbase.procedure.RegionServerProcedureManagerHost;
|
||||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||||
@ -2651,6 +2652,11 @@ public class HRegionServer extends HasThread implements
|
|||||||
static private void createNewReplicationInstance(Configuration conf,
|
static private void createNewReplicationInstance(Configuration conf,
|
||||||
HRegionServer server, FileSystem fs, Path logDir, Path oldLogDir) throws IOException{
|
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.
|
// read in the name of the source replication class from the config file.
|
||||||
String sourceClassname = conf.get(HConstants.REPLICATION_SOURCE_SERVICE_CLASSNAME,
|
String sourceClassname = conf.get(HConstants.REPLICATION_SOURCE_SERVICE_CLASSNAME,
|
||||||
HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT);
|
HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user