Skip to content

Commit d4edfe4

Browse files
committed
HBASE-27676 Scan handlers in the RPC executor should match at least one scan queues (#5074)
Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
1 parent a10cbf8 commit d4edfe4

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
@@ -79,11 +79,13 @@ public RWQueueRpcExecutor(final String name, final int handlerCount, final int m
7979
int readQueues = calcNumReaders(this.numCallQueues, callqReadShare);
8080
int readHandlers = Math.max(readQueues, calcNumReaders(handlerCount, callqReadShare));
8181

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

85-
if ((readQueues - scanQueues) > 0) {
86-
readQueues -= scanQueues;
86+
if (scanQueues > 0) {
87+
// if scanQueues > 0, the handler count of read should > 0, then we make readQueues >= 1
88+
readQueues = Math.max(1, readQueues - scanQueues);
8789
readHandlers -= scanHandlers;
8890
} else {
8991
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)