HBASE-16815 Low scan ratio in RPC queue tuning triggers divide by zero exception

Signed-off-by: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
This commit is contained in:
Guanghao Zhang 2016-10-14 18:29:25 +08:00 committed by Matteo Bertozzi
parent 4983c742e0
commit 6415137574
1 changed files with 8 additions and 7 deletions

View File

@ -146,17 +146,16 @@ public class RWQueueRpcExecutor extends RpcExecutor {
this.scanBalancer = numScanQueues > 0 ? getBalancer(numScanQueues) : null; this.scanBalancer = numScanQueues > 0 ? getBalancer(numScanQueues) : null;
queues = new ArrayList<BlockingQueue<CallRunner>>(numWriteQueues + numReadQueues + numScanQueues); queues = new ArrayList<BlockingQueue<CallRunner>>(numWriteQueues + numReadQueues + numScanQueues);
LOG.debug(name + " writeQueues=" + numWriteQueues + " writeHandlers=" + writeHandlersCount + LOG.info(name + " writeQueues=" + numWriteQueues + " writeHandlers=" + writeHandlersCount
" readQueues=" + numReadQueues + " readHandlers=" + readHandlersCount + + " readQueues=" + numReadQueues + " readHandlers=" + readHandlersCount + " scanQueues="
((numScanQueues == 0) ? "" : " scanQueues=" + numScanQueues + + numScanQueues + " scanHandlers=" + scanHandlersCount);
" scanHandlers=" + scanHandlersCount));
if (writeQueueInitArgs.length > 0) { if (writeQueueInitArgs.length > 0) {
currentQueueLimit = (int) writeQueueInitArgs[0]; currentQueueLimit = (int) writeQueueInitArgs[0];
writeQueueInitArgs[0] = Math.max((int) writeQueueInitArgs[0], writeQueueInitArgs[0] = Math.max((int) writeQueueInitArgs[0],
DEFAULT_CALL_QUEUE_SIZE_HARD_LIMIT); DEFAULT_CALL_QUEUE_SIZE_HARD_LIMIT);
} }
for (int i = 0; i < numWriteQueues; ++i) { for (int i = 0; i < numWriteQueues; ++i) {
queues.add((BlockingQueue<CallRunner>) queues.add((BlockingQueue<CallRunner>)
ReflectionUtils.newInstance(writeQueueClass, writeQueueInitArgs)); ReflectionUtils.newInstance(writeQueueClass, writeQueueInitArgs));
} }
@ -176,8 +175,10 @@ public class RWQueueRpcExecutor extends RpcExecutor {
protected void startHandlers(final int port) { protected void startHandlers(final int port) {
startHandlers(".write", writeHandlersCount, queues, 0, numWriteQueues, port); startHandlers(".write", writeHandlersCount, queues, 0, numWriteQueues, port);
startHandlers(".read", readHandlersCount, queues, numWriteQueues, numReadQueues, port); startHandlers(".read", readHandlersCount, queues, numWriteQueues, numReadQueues, port);
startHandlers(".scan", scanHandlersCount, queues, if (numScanQueues > 0) {
numWriteQueues + numReadQueues, numScanQueues, port); startHandlers(".scan", scanHandlersCount, queues, numWriteQueues + numReadQueues,
numScanQueues, port);
}
} }
@Override @Override