HBASE-27676 Scan handlers in the RPC executor should match at least one scan queues (#5074)
Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
This commit is contained in:
parent
a10cbf8319
commit
d4edfe404e
|
@ -79,11 +79,13 @@ public class RWQueueRpcExecutor extends RpcExecutor {
|
||||||
int readQueues = calcNumReaders(this.numCallQueues, callqReadShare);
|
int readQueues = calcNumReaders(this.numCallQueues, callqReadShare);
|
||||||
int readHandlers = Math.max(readQueues, calcNumReaders(handlerCount, callqReadShare));
|
int readHandlers = Math.max(readQueues, calcNumReaders(handlerCount, callqReadShare));
|
||||||
|
|
||||||
int scanQueues = Math.max(0, (int) Math.floor(readQueues * callqScanShare));
|
|
||||||
int scanHandlers = Math.max(0, (int) Math.floor(readHandlers * callqScanShare));
|
int scanHandlers = Math.max(0, (int) Math.floor(readHandlers * callqScanShare));
|
||||||
|
int scanQueues =
|
||||||
|
scanHandlers > 0 ? Math.max(1, (int) Math.floor(readQueues * callqScanShare)) : 0;
|
||||||
|
|
||||||
if ((readQueues - scanQueues) > 0) {
|
if (scanQueues > 0) {
|
||||||
readQueues -= scanQueues;
|
// if scanQueues > 0, the handler count of read should > 0, then we make readQueues >= 1
|
||||||
|
readQueues = Math.max(1, readQueues - scanQueues);
|
||||||
readHandlers -= scanHandlers;
|
readHandlers -= scanHandlers;
|
||||||
} else {
|
} else {
|
||||||
scanQueues = 0;
|
scanQueues = 0;
|
||||||
|
|
|
@ -67,6 +67,18 @@ public class TestRpcSchedulerFactory {
|
||||||
assertTrue(rpcScheduler.getClass().equals(SimpleRpcScheduler.class));
|
assertTrue(rpcScheduler.getClass().equals(SimpleRpcScheduler.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRWQWithoutReadShare() {
|
||||||
|
// Set some configs just to see how it changes the scheduler. Can't assert the settings had
|
||||||
|
// an effect. Just eyeball the log.
|
||||||
|
this.conf.setDouble(RWQueueRpcExecutor.CALL_QUEUE_READ_SHARE_CONF_KEY, 0);
|
||||||
|
this.conf.setDouble(RpcExecutor.CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 0.5);
|
||||||
|
this.conf.setDouble(RWQueueRpcExecutor.CALL_QUEUE_SCAN_SHARE_CONF_KEY, 0);
|
||||||
|
RpcSchedulerFactory factory = new SimpleRpcSchedulerFactory();
|
||||||
|
RpcScheduler rpcScheduler = factory.create(this.conf, null, null);
|
||||||
|
assertTrue(rpcScheduler.getClass().equals(SimpleRpcScheduler.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFifo() {
|
public void testFifo() {
|
||||||
RpcSchedulerFactory factory = new FifoRpcSchedulerFactory();
|
RpcSchedulerFactory factory = new FifoRpcSchedulerFactory();
|
||||||
|
|
Loading…
Reference in New Issue