adesh-rao commented on a change in pull request #1275:
URL: https://github.com/apache/hive/pull/1275#discussion_r459434134



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java
##########
@@ -89,23 +93,28 @@ public void run() {
         handle = 
txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.Cleaner.name());
         startedAt = System.currentTimeMillis();
         long minOpenTxnId = txnHandler.findMinOpenTxnIdForCleaner();
+        List<CompletableFuture> cleanerList = new ArrayList<>();
         for(CompactionInfo compactionInfo : txnHandler.findReadyToClean()) {
-          clean(compactionInfo, minOpenTxnId);
+          
cleanerList.add(CompletableFuture.runAsync(CompactorUtil.ThrowingRunnable.unchecked(()
 ->
+                  clean(compactionInfo, minOpenTxnId)), cleanerExecutor));
         }
+        CompletableFuture.allOf(cleanerList.toArray(new 
CompletableFuture[0])).join();
       } catch (Throwable t) {
         LOG.error("Caught an exception in the main loop of compactor cleaner, 
" +
-            StringUtils.stringifyException(t));
-      }
-      finally {
+                StringUtils.stringifyException(t));
+        if (cleanerExecutor != null) {
+          cleanerExecutor.shutdownNow();
+          cleanerExecutor = CompactorUtil.createExecutorWithThreadFactory(
+                  
conf.getIntVar(HiveConf.ConfVars.HIVE_COMPACTOR_CLEANER_REQUEST_QUEUE), 
threadNameFormat);
+        }
+      } finally {
         if (handle != null) {
           handle.releaseLocks();
         }
       }
       // Now, go back to bed until it's time to do this again
       long elapsedTime = System.currentTimeMillis() - startedAt;
-      if (elapsedTime >= cleanerCheckInterval || stop.get())  {
-        continue;
-      } else {
+      if (!(elapsedTime >= cleanerCheckInterval || stop.get())) {

Review comment:
       This is outdated. I have added a comment at the right place.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to