You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by de...@apache.org on 2022/03/23 04:03:09 UTC

[hive] branch master updated: HIVE-26058: Choose meaningful names for the Metastore pool threads (#3125) (Zhihua Deng, reviewed by Stamatis Zampetakis)

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

dengzh 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 09a272c  HIVE-26058: Choose meaningful names for the Metastore pool threads (#3125) (Zhihua Deng, reviewed by Stamatis Zampetakis)
09a272c is described below

commit 09a272c9915449c8db845a47c056e0f1ad93235f
Author: dengzh <de...@gmail.com>
AuthorDate: Wed Mar 23 12:02:57 2022 +0800

    HIVE-26058: Choose meaningful names for the Metastore pool threads (#3125) (Zhihua Deng, reviewed by Stamatis Zampetakis)
---
 .../org/apache/hadoop/hive/metastore/HiveMetaStore.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index cd6691e..6831e22 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -67,6 +67,9 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.Condition;
@@ -444,13 +447,20 @@ public class HiveMetaStore extends ThriftHiveMetastore {
       serverSocket = new TServerSocketKeepAlive(serverSocket);
     }
 
+    ExecutorService executorService = new ThreadPoolExecutor(minWorkerThreads, maxWorkerThreads,
+        60L, TimeUnit.SECONDS, new SynchronousQueue<>(), r -> {
+          Thread thread = new Thread(r);
+          thread.setDaemon(true);
+          thread.setName("Metastore-Handler-Pool: Thread-" + thread.getId());
+          return thread;
+        });
+
     TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverSocket)
         .processor(processor)
         .transportFactory(transFactory)
         .protocolFactory(protocolFactory)
         .inputProtocolFactory(inputProtoFactory)
-        .minWorkerThreads(minWorkerThreads)
-        .maxWorkerThreads(maxWorkerThreads);
+        .executorService(executorService);
 
     TServer tServer = new TThreadPoolServer(args);
     TServerEventHandler tServerEventHandler = new TServerEventHandler() {