[ 
https://issues.apache.org/jira/browse/HIVE-22872?focusedWorklogId=395698&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-395698
 ]

ASF GitHub Bot logged work on HIVE-22872:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Mar/20 01:35
            Start Date: 02/Mar/20 01:35
    Worklog Time Spent: 10m 
      Work Description: jcamachor commented on pull request #924: HIVE-22872 
schq executors
URL: https://github.com/apache/hive/pull/924#discussion_r386162020
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/scheduled/ScheduledQueryExecutionService.java
 ##########
 @@ -48,18 +53,29 @@
   private static ScheduledQueryExecutionService INSTANCE = null;
 
   private ScheduledQueryExecutionContext context;
-  private ScheduledQueryExecutor worker;
   private AtomicInteger forcedScheduleCheckCounter = new AtomicInteger();
+  private ScheduledQueryPoller poller;
+  AtomicInteger usedExecutors = new AtomicInteger(0);
+  List<ScheduledQueryExecutor> runningWorkers = new LinkedList<>();
 
   public static ScheduledQueryExecutionService 
startScheduledQueryExecutorService(HiveConf inputConf) {
     HiveConf conf = new HiveConf(inputConf);
     MetastoreBasedScheduledQueryService qService = new 
MetastoreBasedScheduledQueryService(conf);
-    ExecutorService executor = Executors.newCachedThreadPool(
-        new ThreadFactoryBuilder().setDaemon(true).setNameFormat("Scheduled 
Query Thread %d").build());
+    ExecutorService executor = buildExecutor(conf);
     ScheduledQueryExecutionContext ctx = new 
ScheduledQueryExecutionContext(executor, conf, qService);
     return startScheduledQueryExecutorService(ctx);
   }
 
+  private static ExecutorService buildExecutor(HiveConf conf) {
+    ThreadFactory threadFactory = new 
ThreadFactoryBuilder().setDaemon(true).setNameFormat("Scheduled Query Thread 
%d").build();
+    int systemThreads = 2; // poller,reporter
+    int maxServiceThreads = 
conf.getIntVar(ConfVars.HIVE_SCHEDULED_QUERIES_MAX_EXECUTORS);
+    return new ThreadPoolExecutor(systemThreads + 1, systemThreads + 
maxServiceThreads,
 
 Review comment:
   Can we leave a comment here? It seems we are always keeping at least poller, 
reporter, and an executor? It seems to me that minimum number of conf value 
HIVE_SCHEDULED_QUERIES_MAX_EXECUTORS should be 1 for this to work properly; 
though this is probably evident, we may leave a bit of this information to 
users in HiveConf description of the property.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 395698)

> Support multiple executors for scheduled queries
> ------------------------------------------------
>
>                 Key: HIVE-22872
>                 URL: https://issues.apache.org/jira/browse/HIVE-22872
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-22872.01.patch, HIVE-22872.02.patch, 
> HIVE-22872.03.patch, HIVE-22872.04.patch, HIVE-22872.05.patch, 
> HIVE-22872.06.patch
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to