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 e0203ab0012..68e7b6541f6 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>(numWriteQueues + numReadQueues + numScanQueues); LOG.debug(name + " writeQueues=" + numWriteQueues + " writeHandlers=" + writeHandlersCount + 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 97ef97369f0..8ae3078a270 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 @@ -250,6 +250,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();