From 7b7f56ef7e49c066d78258f997c479b5382ee9aa Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Tue, 19 Feb 2019 15:13:03 +0800 Subject: [PATCH] HBASE-21928 Use MasterFifoRpcScheduler by default for HMaster --- .../hadoop/hbase/ipc/MasterFifoRpcScheduler.java | 11 +++++++---- .../apache/hadoop/hbase/master/MasterRpcServices.java | 7 ++++--- .../regionserver/MasterFifoRpcSchedulerFactory.java | 7 +++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterFifoRpcScheduler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterFifoRpcScheduler.java index b596c40e75..ae02f2021d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterFifoRpcScheduler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MasterFifoRpcScheduler.java @@ -32,10 +32,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * A special {@code }RpcScheduler} only used for master. This scheduler separates RegionServerReport - * requests to independent handlers to avoid these requests block other requests. To use this - * scheduler, please set "hbase.master.rpc.scheduler.factory.class" to - * "org.apache.hadoop.hbase.ipc.MasterFifoRpcScheduler". + * A special {@code RpcScheduler} only used for master. This scheduler separates RegionServerReport + * requests to independent handlers to avoid these requests block other requests. + *

+ * To use this scheduler, please set "hbase.master.rpc.scheduler.factory.class" to + * "org.apache.hadoop.hbase.ipc.MasterFifoRpcSchedulerFactory". + *

+ * This is the default scheduler for master for 2.2.0+. */ @InterfaceAudience.Private @InterfaceStability.Evolving diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java index 1ff3f0eaa7..a9747dbe0c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java @@ -86,6 +86,7 @@ import org.apache.hadoop.hbase.quotas.MasterQuotaManager; import org.apache.hadoop.hbase.quotas.QuotaObserverChore; import org.apache.hadoop.hbase.quotas.QuotaUtil; import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot; +import org.apache.hadoop.hbase.regionserver.MasterFifoRpcSchedulerFactory; import org.apache.hadoop.hbase.regionserver.RSRpcServices; import org.apache.hadoop.hbase.regionserver.RpcSchedulerFactory; import org.apache.hadoop.hbase.replication.ReplicationException; @@ -323,8 +324,8 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.Snapshot @InterfaceAudience.Private @SuppressWarnings("deprecation") public class MasterRpcServices extends RSRpcServices - implements MasterService.BlockingInterface, RegionServerStatusService.BlockingInterface, - LockService.BlockingInterface, HbckService.BlockingInterface { + implements MasterService.BlockingInterface, RegionServerStatusService.BlockingInterface, + LockService.BlockingInterface, HbckService.BlockingInterface { private static final Logger LOG = LoggerFactory.getLogger(MasterRpcServices.class.getName()); private final HMaster master; @@ -358,7 +359,7 @@ public class MasterRpcServices extends RSRpcServices protected Class getRpcSchedulerFactoryClass() { Configuration conf = getConfiguration(); if (conf != null) { - return conf.getClass(MASTER_RPC_SCHEDULER_FACTORY_CLASS, super.getRpcSchedulerFactoryClass()); + return conf.getClass(MASTER_RPC_SCHEDULER_FACTORY_CLASS, MasterFifoRpcSchedulerFactory.class); } else { return super.getRpcSchedulerFactoryClass(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MasterFifoRpcSchedulerFactory.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MasterFifoRpcSchedulerFactory.java index da2309a1fb..4872540f4a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MasterFifoRpcSchedulerFactory.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MasterFifoRpcSchedulerFactory.java @@ -27,17 +27,20 @@ import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; /** - * Factory to use when you want to use the {@link MasterFifoRpcScheduler} + * Factory to use when you want to use the {@link MasterFifoRpcScheduler}. + *

+ * This is the default scheduler for master for 2.2.0+. */ @InterfaceAudience.Private @InterfaceStability.Evolving public class MasterFifoRpcSchedulerFactory extends FifoRpcSchedulerFactory { + @Override public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) { int totalHandlerCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT, HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT); int rsReportHandlerCount = Math.max(1, conf - .getInt(MasterFifoRpcScheduler.MASTER_SERVER_REPORT_HANDLER_COUNT, totalHandlerCount / 2)); + .getInt(MasterFifoRpcScheduler.MASTER_SERVER_REPORT_HANDLER_COUNT, totalHandlerCount / 2)); int callHandlerCount = Math.max(1, totalHandlerCount - rsReportHandlerCount); return new MasterFifoRpcScheduler(conf, callHandlerCount, rsReportHandlerCount); } -- 2.17.1