Skip to content

Commit

Permalink
HBASE-27676 Scan handlers in the RPC executor should match at least o…
Browse files Browse the repository at this point in the history
…ne scan queues (apache#5074)

Signed-off-by: Bryan Beaudreault <[email protected]>
  • Loading branch information
sunhelly committed Mar 22, 2023
1 parent de375bc commit 8b0ae80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ public RWQueueRpcExecutor(final String name, final int handlerCount, final int m
int readQueues = calcNumReaders(this.numCallQueues, 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 scanQueues =
scanHandlers > 0 ? Math.max(1, (int) Math.floor(readQueues * callqScanShare)) : 0;

if ((readQueues - scanQueues) > 0) {
readQueues -= scanQueues;
if (scanQueues > 0) {
// if scanQueues > 0, the handler count of read should > 0, then we make readQueues >= 1
readQueues = Math.max(1, readQueues - scanQueues);
readHandlers -= scanHandlers;
} else {
scanQueues = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ public void testRWQ() {
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
public void testFifo() {
RpcSchedulerFactory factory = new FifoRpcSchedulerFactory();
Expand Down

0 comments on commit 8b0ae80

Please sign in to comment.