You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ha...@apache.org on 2023/03/22 00:11:39 UTC
[hbase] branch branch-2.4 updated: HBASE-27676 Scan handlers in the RPC executor should match at least one scan queues (#5074)
This is an automated email from the ASF dual-hosted git repository.
haxiaolin pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 8b0ae80da9b HBASE-27676 Scan handlers in the RPC executor should match at least one scan queues (#5074)
8b0ae80da9b is described below
commit 8b0ae80da9b469896ccf01aa49346c29224ddcb3
Author: Xiaolin Ha <ha...@apache.org>
AuthorDate: Wed Mar 22 08:07:31 2023 +0800
HBASE-27676 Scan handlers in the RPC executor should match at least one scan queues (#5074)
Signed-off-by: Bryan Beaudreault <bb...@apache.org>
---
.../java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java | 8 +++++---
.../hadoop/hbase/regionserver/TestRpcSchedulerFactory.java | 12 ++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
index 3b1a2faf016..13f83b6a829 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java
@@ -78,11 +78,13 @@ public class RWQueueRpcExecutor extends RpcExecutor {
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;
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRpcSchedulerFactory.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRpcSchedulerFactory.java
index 91f637aa3de..17f0dc3a783 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRpcSchedulerFactory.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRpcSchedulerFactory.java
@@ -67,6 +67,18 @@ public class TestRpcSchedulerFactory {
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();