HBASE-14252 RegionServers fail to start when setting hbase.ipc.server.callqueue.scan.ratio to 0 (Yubao Liu and Ted Yu)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/793d976d Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/793d976d Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/793d976d Branch: refs/heads/HBASE-14850 Commit: 793d976d87449bf833189622db6fe4bb33791fdd Parents: 1eac103 Author: tedyu <[email protected]> Authored: Mon Apr 25 13:26:47 2016 -0700 Committer: tedyu <[email protected]> Committed: Mon Apr 25 13:26:47 2016 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java | 2 +- .../hadoop/hbase/ipc/TestSimpleRpcScheduler.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/793d976d/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java index e0203ab..68e7b65 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java @@ -142,7 +142,7 @@ public class RWQueueRpcExecutor extends RpcExecutor { this.numScanQueues = numScanQueues; this.writeBalancer = getBalancer(numWriteQueues); this.readBalancer = getBalancer(numReadQueues); - this.scanBalancer = getBalancer(numScanQueues); + this.scanBalancer = numScanQueues > 0 ? getBalancer(numScanQueues) : null; queues = new ArrayList<BlockingQueue<CallRunner>>(numWriteQueues + numReadQueues + numScanQueues); LOG.debug(name + " writeQueues=" + numWriteQueues + " writeHandlers=" + writeHandlersCount + http://git-wip-us.apache.org/repos/asf/hbase/blob/793d976d/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java index 97ef973..8ae3078 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestSimpleRpcScheduler.java @@ -251,6 +251,22 @@ public class TestSimpleRpcScheduler { } @Test + public void testScanQueueWithZeroScanRatio() throws Exception { + Configuration schedConf = HBaseConfiguration.create(); + schedConf.setFloat(SimpleRpcScheduler.CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 1.0f); + schedConf.setFloat(SimpleRpcScheduler.CALL_QUEUE_READ_SHARE_CONF_KEY, 0.5f); + schedConf.setFloat(SimpleRpcScheduler.CALL_QUEUE_SCAN_SHARE_CONF_KEY, 0f); + + PriorityFunction priority = mock(PriorityFunction.class); + when(priority.getPriority(any(RequestHeader.class), any(Message.class), + any(User.class))).thenReturn(HConstants.NORMAL_QOS); + + RpcScheduler scheduler = new SimpleRpcScheduler(schedConf, 2, 1, 1, priority, + HConstants.QOS_THRESHOLD); + assertNotEquals(scheduler, null); + } + + @Test public void testScanQueues() throws Exception { Configuration schedConf = HBaseConfiguration.create(); schedConf.setFloat(SimpleRpcScheduler.CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 1.0f);
