You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2023/01/12 13:57:45 UTC

[hbase] branch branch-2 updated: HBASE-27565 Make the initial corePoolSize configurable for ChoreService (#4958)

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

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


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 655a4366a5e HBASE-27565 Make the initial corePoolSize configurable for ChoreService (#4958)
655a4366a5e is described below

commit 655a4366a5e82617c770643a0485cac1a699c3a7
Author: Peter Somogyi <ps...@apache.org>
AuthorDate: Thu Jan 12 14:41:41 2023 +0100

    HBASE-27565 Make the initial corePoolSize configurable for ChoreService (#4958)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../src/main/java/org/apache/hadoop/hbase/ChoreService.java         | 6 ++++++
 .../java/org/apache/hadoop/hbase/regionserver/HRegionServer.java    | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
index 01f81356190..8b1e5732663 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ChoreService.java
@@ -59,6 +59,12 @@ public class ChoreService {
    */
   @InterfaceAudience.Private
   public final static int MIN_CORE_POOL_SIZE = 1;
+  /**
+   * The initial number of threads in the core pool for the {@link ChoreService}.
+   */
+  public static final String CHORE_SERVICE_INITIAL_POOL_SIZE =
+    "hbase.choreservice.initial.pool.size";
+  public static final int DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE = 1;
 
   /**
    * This thread pool is used to schedule all of the Chores
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index dcd5597baf5..aa8fdebde3b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import static org.apache.hadoop.hbase.ChoreService.CHORE_SERVICE_INITIAL_POOL_SIZE;
+import static org.apache.hadoop.hbase.ChoreService.DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE;
 import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK;
 import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_WAL_MAX_SPLITTER;
 import static org.apache.hadoop.hbase.HConstants.DEFAULT_SLOW_LOG_SYS_TABLE_CHORE_DURATION;
@@ -728,7 +730,9 @@ public class HRegionServer extends Thread
       // and M (An M IS A HRS now). Need to refactor so less duplication between M and its super
       // Master expects Constructor to put up web servers. Ugh.
       // class HRS. TODO.
-      this.choreService = new ChoreService(getName(), true);
+      int choreServiceInitialSize =
+        conf.getInt(CHORE_SERVICE_INITIAL_POOL_SIZE, DEFAULT_CHORE_SERVICE_INITIAL_POOL_SIZE);
+      this.choreService = new ChoreService(getName(), choreServiceInitialSize, true);
       this.executorService = new ExecutorService(getName());
       putUpWebUI();
       span.setStatus(StatusCode.OK);