You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2019/12/03 12:26:15 UTC

[hive] branch master updated: HIVE-22554: ACID: Wait timeout for blocking compaction should be configurable (Laszlo Pinter via Peter Vary)

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

pvary 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 601937d  HIVE-22554: ACID: Wait timeout for blocking compaction should be configurable (Laszlo Pinter via Peter Vary)
601937d is described below

commit 601937d958face5f4521468592f55cdd1b94e7e8
Author: Laszlo Pinter <lp...@cloudera.com>
AuthorDate: Tue Dec 3 13:26:04 2019 +0100

    HIVE-22554: ACID: Wait timeout for blocking compaction should be configurable (Laszlo Pinter via Peter Vary)
---
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java            | 3 +++
 .../hadoop/hive/ql/ddl/table/storage/AlterTableCompactOperation.java | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 4393a28..76c6e39 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2761,6 +2761,9 @@ public class HiveConf extends Configuration {
     HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD("hive.compactor.abortedtxn.threshold", 1000,
         "Number of aborted transactions involving a given table or partition that will trigger\n" +
         "a major compaction."),
+
+    HIVE_COMPACTOR_WAIT_TIMEOUT("hive.compactor.wait.timeout", 300000L, "Time out in "
+        + "milliseconds for blocking compaction. It's value has to be higher than 2000 milliseconds. "),
     /**
      * @deprecated Use MetastoreConf.COMPACTOR_INITIATOR_FAILED_THRESHOLD
      */
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableCompactOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableCompactOperation.java
index fd0ae3a..8e576fa 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableCompactOperation.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/AlterTableCompactOperation.java
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.hive.ql.ddl.table.storage;
 
+import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.ql.ddl.DDLOperationContext;
 import org.apache.hadoop.hive.ql.io.AcidUtils;
 
@@ -38,7 +39,6 @@ import org.apache.hadoop.hive.ql.metadata.Table;
  * Operation process of compacting a table.
  */
 public class AlterTableCompactOperation extends DDLOperation<AlterTableCompactDesc> {
-  private static final int FIVE_MINUTES_IN_MILLIES = 5*60*1000;
 
   public AlterTableCompactOperation(DDLOperationContext context, AlterTableCompactDesc desc) {
     super(context, desc);
@@ -96,10 +96,11 @@ public class AlterTableCompactOperation extends DDLOperation<AlterTableCompactDe
   private void waitForCompactionToFinish(CompactionResponse resp) throws HiveException {
     StringBuilder progressDots = new StringBuilder();
     long waitTimeMs = 1000;
+    long waitTimeOut = HiveConf.getLongVar(context.getConf(), HiveConf.ConfVars.HIVE_COMPACTOR_WAIT_TIMEOUT);
     wait: while (true) {
       //double wait time until 5min
       waitTimeMs = waitTimeMs*2;
-      waitTimeMs = Math.max(waitTimeMs, FIVE_MINUTES_IN_MILLIES);
+      waitTimeMs = Math.max(waitTimeMs, waitTimeOut);
       try {
         Thread.sleep(waitTimeMs);
       } catch (InterruptedException ex) {