deniskuzZ commented on a change in pull request #1275:
URL: https://github.com/apache/hive/pull/1275#discussion_r458649513
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java
##########
@@ -80,39 +98,58 @@ public void run() {
HiveConf.ConfVars.HIVE_COMPACTOR_CLEANER_RUN_INTERVAL,
TimeUnit.MILLISECONDS);
}
- do {
- TxnStore.MutexAPI.LockHandle handle = null;
- long startedAt = -1;
- // Make sure nothing escapes this run method and kills the metastore at
large,
- // so wrap it in a big catch Throwable statement.
- try {
- handle =
txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.Cleaner.name());
- startedAt = System.currentTimeMillis();
- long minOpenTxnId = txnHandler.findMinOpenTxnIdForCleaner();
- for(CompactionInfo compactionInfo : txnHandler.findReadyToClean()) {
- clean(compactionInfo, minOpenTxnId);
+ try {
+ do {
+ TxnStore.MutexAPI.LockHandle handle = null;
+ long startedAt = -1;
+ // Make sure nothing escapes this run method and kills the metastore
at large,
+ // so wrap it in a big catch Throwable statement.
+ try {
+ handle =
txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.Cleaner.name());
+ startedAt = System.currentTimeMillis();
+ long minOpenTxnId = txnHandler.findMinOpenTxnIdForCleaner();
+ int count = 0;
+ for(CompactionInfo compactionInfo : txnHandler.findReadyToClean()) {
+ completionService.submit(() -> {
+ ThrowingRunnable.unchecked(() -> clean(compactionInfo,
minOpenTxnId));
+ return null;
+ });
+ count++;
+ }
+
+ for(int i=0; i<count; i++) {
+ try {
+ completionService.take().get();
Review comment:
CompletableFuture is a better choice
----------------------------------------------------------------
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]