You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by rb...@apache.org on 2022/03/06 22:20:54 UTC

[hive] branch master updated: HIVE-25971: Closing the thread pool created for async cache (#3078)

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

rbalamohan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new a6d5e7b  HIVE-25971: Closing the thread pool created for async cache (#3078)
a6d5e7b is described below

commit a6d5e7b5477a9b79478ab38d2f96e3bfbe4683a3
Author: Shailesh Gupta <gu...@gmail.com>
AuthorDate: Mon Mar 7 03:50:32 2022 +0530

    HIVE-25971: Closing the thread pool created for async cache (#3078)
    
    (cherry picked from commit a6153179f1f981bdce6adf5d29c3707d3367bbac)
    
    Co-authored-by: Shailesh Gupta <sh...@amazon.com>
---
 ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java  | 9 ++++++++-
 ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java
index 6efbb48..d86fb32 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java
@@ -23,6 +23,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
@@ -61,7 +62,7 @@ public class ObjectCache implements org.apache.hadoop.hive.ql.exec.ObjectCache {
 
   public static void setupObjectRegistry(ObjectRegistry objectRegistry) {
     staticRegistry = objectRegistry;
-    staticPool = Executors.newCachedThreadPool();
+    staticPool = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Tez-object-cache %d").build());
   }
 
   @Override
@@ -120,4 +121,10 @@ public class ObjectCache implements org.apache.hadoop.hive.ql.exec.ObjectCache {
     LOG.info("Removing key: " + key);
     registry.delete(key);
   }
+
+  public static void close() {
+    if (staticPool != null) {
+      staticPool.shutdown();
+    }
+  }
 }
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java
index 87010d4..e6fe377 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java
@@ -155,6 +155,7 @@ public class TezProcessor extends AbstractLogicalIOProcessor {
 
   @Override
   public void close() throws IOException {
+    ObjectCache.close();
     // we have to close in the processor's run method, because tez closes inputs
     // before calling close (TEZ-955) and we might need to read inputs
     // when we flush the pipeline.