HBASE-16087 Replication shouldn't start on a master if if only hosts system tables
This commit is contained in:
parent
1318e84e14
commit
ff8c2fcac0
|
@ -1001,6 +1001,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);
|
||||||
|
|
|
@ -107,6 +107,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.procedure.RegionServerProcedureManagerHost;
|
import org.apache.hadoop.hbase.procedure.RegionServerProcedureManagerHost;
|
||||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||||
import org.apache.hadoop.hbase.protobuf.RequestConverter;
|
import org.apache.hadoop.hbase.protobuf.RequestConverter;
|
||||||
|
@ -447,7 +448,7 @@ public class HRegionServer extends HasThread implements
|
||||||
private RegionServerCoprocessorHost rsHost;
|
private RegionServerCoprocessorHost rsHost;
|
||||||
|
|
||||||
private RegionServerProcedureManagerHost rspmHost;
|
private RegionServerProcedureManagerHost rspmHost;
|
||||||
|
|
||||||
private RegionServerQuotaManager rsQuotaManager;
|
private RegionServerQuotaManager rsQuotaManager;
|
||||||
|
|
||||||
// Table level lock manager for locking for region operations
|
// Table level lock manager for locking for region operations
|
||||||
|
@ -873,7 +874,7 @@ public class HRegionServer extends HasThread implements
|
||||||
|
|
||||||
// Setup the Quota Manager
|
// Setup the Quota Manager
|
||||||
rsQuotaManager = new RegionServerQuotaManager(this);
|
rsQuotaManager = new RegionServerQuotaManager(this);
|
||||||
|
|
||||||
// Setup RPC client for master communication
|
// Setup RPC client for master communication
|
||||||
rpcClient = RpcClientFactory.createClient(conf, clusterId, new InetSocketAddress(
|
rpcClient = RpcClientFactory.createClient(conf, clusterId, new InetSocketAddress(
|
||||||
rpcServices.isa.getAddress(), 0), clusterConnection.getConnectionMetrics());
|
rpcServices.isa.getAddress(), 0), clusterConnection.getConnectionMetrics());
|
||||||
|
@ -942,7 +943,7 @@ public class HRegionServer extends HasThread implements
|
||||||
// since the server is ready to run
|
// since the server is ready to run
|
||||||
rspmHost.start();
|
rspmHost.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the Quota Manager
|
// Start the Quota Manager
|
||||||
if (this.rsQuotaManager != null) {
|
if (this.rsQuotaManager != null) {
|
||||||
rsQuotaManager.start(getRpcServer().getScheduler());
|
rsQuotaManager.start(getRpcServer().getScheduler());
|
||||||
|
@ -1036,7 +1037,7 @@ public class HRegionServer extends HasThread implements
|
||||||
if (rsQuotaManager != null) {
|
if (rsQuotaManager != null) {
|
||||||
rsQuotaManager.stop();
|
rsQuotaManager.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the snapshot and other procedure handlers, forcefully killing all running tasks
|
// Stop the snapshot and other procedure handlers, forcefully killing all running tasks
|
||||||
if (rspmHost != null) {
|
if (rspmHost != null) {
|
||||||
rspmHost.stop(this.abortRequested || this.killed);
|
rspmHost.stop(this.abortRequested || this.killed);
|
||||||
|
@ -2600,7 +2601,7 @@ public class HRegionServer extends HasThread implements
|
||||||
public ChoreService getChoreService() {
|
public ChoreService getChoreService() {
|
||||||
return choreService;
|
return choreService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RegionServerQuotaManager getRegionServerQuotaManager() {
|
public RegionServerQuotaManager getRegionServerQuotaManager() {
|
||||||
return rsQuotaManager;
|
return rsQuotaManager;
|
||||||
|
@ -2622,6 +2623,11 @@ public class HRegionServer extends HasThread implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
@ -2723,7 +2729,7 @@ public class HRegionServer extends HasThread implements
|
||||||
}
|
}
|
||||||
return tableRegions;
|
return tableRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the online tables in this RS.
|
* Gets the online tables in this RS.
|
||||||
* This method looks at the in-memory onlineRegions.
|
* This method looks at the in-memory onlineRegions.
|
||||||
|
|
Loading…
Reference in New Issue