Skip to content

Commit 8b0ae80

Browse files
committed
HBASE-27676 Scan handlers in the RPC executor should match at least one scan queues (#5074)
Signed-off-by: Bryan Beaudreault <[email protected]>
1 parent de375bc commit 8b0ae80

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ public RWQueueRpcExecutor(final String name, final int handlerCount, final int m
7878
int readQueues = calcNumReaders(this.numCallQueues, callqReadShare);
7979
int readHandlers = Math.max(readQueues, calcNumReaders(handlerCount, callqReadShare));
8080

81-
int scanQueues = Math.max(0, (int) Math.floor(readQueues * callqScanShare));
8281
int scanHandlers = Math.max(0, (int) Math.floor(readHandlers * callqScanShare));
82+
int scanQueues =
83+
scanHandlers > 0 ? Math.max(1, (int) Math.floor(readQueues * callqScanShare)) : 0;
8384

84-
if ((readQueues - scanQueues) > 0) {
85-
readQueues -= scanQueues;
85+
if (scanQueues > 0) {
86+
// if scanQueues > 0, the handler count of read should > 0, then we make readQueues >= 1
87+
readQueues = Math.max(1, readQueues - scanQueues);
8688
readHandlers -= scanHandlers;
8789
} else {
8890
scanQueues = 0;

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRpcSchedulerFactory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ public void testRWQ() {
6767
assertTrue(rpcScheduler.getClass().equals(SimpleRpcScheduler.class));
6868
}
6969

70+
@Test
71+
public void testRWQWithoutReadShare() {
72+
// Set some configs just to see how it changes the scheduler. Can't assert the settings had
73+
// an effect. Just eyeball the log.
74+
this.conf.setDouble(RWQueueRpcExecutor.CALL_QUEUE_READ_SHARE_CONF_KEY, 0);
75+
this.conf.setDouble(RpcExecutor.CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 0.5);
76+
this.conf.setDouble(RWQueueRpcExecutor.CALL_QUEUE_SCAN_SHARE_CONF_KEY, 0);
77+
RpcSchedulerFactory factory = new SimpleRpcSchedulerFactory();
78+
RpcScheduler rpcScheduler = factory.create(this.conf, null, null);
79+
assertTrue(rpcScheduler.getClass().equals(SimpleRpcScheduler.class));
80+
}
81+
7082
@Test
7183
public void testFifo() {
7284
RpcSchedulerFactory factory = new FifoRpcSchedulerFactory();

0 commit comments

Comments
 (0)