You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by an...@apache.org on 2021/07/21 12:07:44 UTC

[hbase] branch branch-2.3 updated: HBASE-26088 Fix thread leaks in conn#getBufferedMutator(tableName) method call (#3506)

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

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


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new 82ea267  HBASE-26088 Fix thread leaks in conn#getBufferedMutator(tableName) method call (#3506)
82ea267 is described below

commit 82ea2675c4201b483eab3ec892355761fb534c7e
Author: Rushabh Shah <sh...@gmail.com>
AuthorDate: Wed Jul 21 08:02:44 2021 -0400

    HBASE-26088 Fix thread leaks in conn#getBufferedMutator(tableName) method call (#3506)
    
    Co-authored-by: Rushabh Shah <ru...@rushabh-ltmflld.internal.salesforce.com>
    Signed-off-by: zhangduo <zh...@apache.org>
    Signed-off-by: Anoop <an...@apache.org>
    Signed-off-by: stack <st...@duboce.net>
    Signed-off-by: Reid Chan <re...@apache.org>
---
 .../main/java/org/apache/hadoop/hbase/client/Connection.java | 12 +++++++-----
 .../apache/hadoop/hbase/client/ConnectionImplementation.java |  3 ---
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
index 90891f4..3ea13a4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
@@ -109,16 +109,15 @@ public interface Connection extends Abortable, Closeable {
   /**
    * <p>
    * Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
-   * {@link BufferedMutator} returned by this method is thread-safe. This BufferedMutator will
-   * use the Connection's ExecutorService. This object can be used for long lived operations.
+   * {@link BufferedMutator} returned by this method is thread-safe.
+   * This accessor will create a new ThreadPoolExecutor and will be shutdown once we close the
+   *  BufferedMutator. This object can be used for long lived operations.
    * </p>
    * <p>
    * The caller is responsible for calling {@link BufferedMutator#close()} on
    * the returned {@link BufferedMutator} instance.
    * </p>
    * <p>
-   * This accessor will use the connection's ExecutorService and will throw an
-   * exception in the main thread when an asynchronous exception occurs.
    *
    * @param tableName the name of the table
    *
@@ -129,7 +128,10 @@ public interface Connection extends Abortable, Closeable {
   /**
    * Retrieve a {@link BufferedMutator} for performing client-side buffering of writes. The
    * {@link BufferedMutator} returned by this method is thread-safe. This object can be used for
-   * long lived table operations. The caller is responsible for calling
+   * long lived table operations. If user passes ThreadPool in BufferedMutatorParams then we will
+   * use that otherwise we will create for the user. For user specified ThreadPool, it is the user's
+   * responsibility to shutdown. For ThreadPool created by us, we will shutdown when user calls
+   * {@link BufferedMutator#close()}. The caller is responsible for calling
    * {@link BufferedMutator#close()} on the returned {@link BufferedMutator} instance.
    *
    * @param params details on how to instantiate the {@code BufferedMutator}.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
index 0b11185..4d2a41f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
@@ -384,9 +384,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
     if (params.getTableName() == null) {
       throw new IllegalArgumentException("TableName cannot be null.");
     }
-    if (params.getPool() == null) {
-      params.pool(HTable.getDefaultExecutor(getConfiguration()));
-    }
     if (params.getWriteBufferSize() == BufferedMutatorParams.UNSET) {
       params.writeBufferSize(connectionConfig.getWriteBufferSize());
     }