HBASE-14252 RegionServers fail to start when setting hbase.ipc.server.callqueue.scan.ratio to 0 (Yubao Liu and Ted Yu)

This commit is contained in:
tedyu 2016-04-25 13:26:47 -07:00
parent 1eac103ead
commit 793d976d87
2 changed files with 17 additions and 1 deletions

View File

@ -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 +

View File

@ -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();