You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by re...@apache.org on 2019/06/14 03:25:03 UTC

[hbase] branch branch-1 updated: HBASE-22559 [RPC] set guard against CALL_QUEUE_HANDLER_FACTOR_CONF_KEY

This is an automated email from the ASF dual-hosted git repository.

reidchan pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1 by this push:
     new 2ff4e4f  HBASE-22559 [RPC] set guard against CALL_QUEUE_HANDLER_FACTOR_CONF_KEY
2ff4e4f is described below

commit 2ff4e4f09630a8c04e57d16a71362708dd165532
Author: Reid Chan <re...@apache.org>
AuthorDate: Fri Jun 14 11:24:55 2019 +0800

    HBASE-22559 [RPC] set guard against CALL_QUEUE_HANDLER_FACTOR_CONF_KEY
---
 .../main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
index 15c416c..d46786b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcExecutor.java
@@ -133,6 +133,20 @@ public abstract class RpcExecutor {
     this.abortable = abortable;
 
     float callQueuesHandlersFactor = this.conf.getFloat(CALL_QUEUE_HANDLER_FACTOR_CONF_KEY, 0);
+    if (Float.compare(callQueuesHandlersFactor, 1.0f) > 0 ||
+        Float.compare(0.0f, callQueuesHandlersFactor) > 0) {
+      LOG.warn(CALL_QUEUE_HANDLER_FACTOR_CONF_KEY +
+        " is *ILLEGAL*, it should be in range [0.0, 1.0]");
+      // For callQueuesHandlersFactor > 1.0, we just set it 1.0f.
+      if (Float.compare(callQueuesHandlersFactor, 1.0f) > 0) {
+        LOG.warn("Set " + CALL_QUEUE_HANDLER_FACTOR_CONF_KEY + " 1.0f");
+        callQueuesHandlersFactor = 1.0f;
+      } else {
+        // But for callQueuesHandlersFactor < 0.0, following method #computeNumCallQueues
+        // will compute max(1, -x) => 1 which has same effect of default value.
+        LOG.warn("Set " + CALL_QUEUE_HANDLER_FACTOR_CONF_KEY + " default value 0.0f");
+      }
+    }
     this.numCallQueues = computeNumCallQueues(handlerCount, callQueuesHandlersFactor);
     this.queues = new ArrayList<>(this.numCallQueues);