You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/10/01 01:09:04 UTC
[22/44] hive git commit: HIVE-14818. Reduce number of retries while
starting HiveServer for tests. (Siddharth Seth,
reviewed by Prasanth Jayachandran)
HIVE-14818. Reduce number of retries while starting HiveServer for tests. (Siddharth Seth, reviewed by Prasanth Jayachandran)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/a2131154
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/a2131154
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/a2131154
Branch: refs/heads/hive-14535
Commit: a21311544a4935785aa964e6f2c66b1669982e8a
Parents: e08d94e
Author: Siddharth Seth <ss...@apache.org>
Authored: Fri Sep 23 14:58:20 2016 -0700
Committer: Siddharth Seth <ss...@apache.org>
Committed: Fri Sep 23 14:58:20 2016 -0700
----------------------------------------------------------------------
common/src/java/org/apache/hadoop/hive/conf/HiveConf.java | 8 ++++++--
.../src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java | 4 ++++
.../src/java/org/apache/hive/service/server/HiveServer2.java | 7 +++++--
3 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/a2131154/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
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 ccdfca6..43a16d7 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2172,9 +2172,13 @@ public class HiveConf extends Configuration {
"SSL Versions to disable for all Hive Servers"),
// HiveServer2 specific configs
+ HIVE_SERVER2_SLEEP_INTERVAL_BETWEEN_START_ATTEMPTS("hive.server2.sleep.interval.between.start.attempts",
+ "60s", new TimeValidator(TimeUnit.MILLISECONDS, 0l, true, Long.MAX_VALUE, true),
+ "Amount of time to sleep between HiveServer2 start attempts. Primarily meant for tests"),
HIVE_SERVER2_MAX_START_ATTEMPTS("hive.server2.max.start.attempts", 30L, new RangeValidator(0L, null),
- "Number of times HiveServer2 will attempt to start before exiting, sleeping 60 seconds " +
- "between retries. \n The default of 30 will keep trying for 30 minutes."),
+ "Number of times HiveServer2 will attempt to start before exiting. The sleep interval between retries" +
+ " is determined by " + ConfVars.HIVE_SERVER2_SLEEP_INTERVAL_BETWEEN_START_ATTEMPTS.varname +
+ "\n The default of 30 will keep trying for 30 minutes."),
HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY("hive.server2.support.dynamic.service.discovery", false,
"Whether HiveServer2 supports dynamic service discovery for its clients. " +
"To support this, each instance of HiveServer2 currently uses ZooKeeper to register itself, " +
http://git-wip-us.apache.org/repos/asf/hive/blob/a2131154/itests/hive-unit/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java b/itests/hive-unit/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
index abb80a2..176761f 100644
--- a/itests/hive-unit/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
+++ b/itests/hive-unit/src/main/java/org/apache/hive/jdbc/miniHS2/MiniHS2.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
@@ -187,6 +188,9 @@ public class MiniHS2 extends AbstractHiveService {
super(hiveConf, "localhost",
(usePortsFromConf ? hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT) : MetaStoreUtils.findFreePort()),
(usePortsFromConf ? hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT) : MetaStoreUtils.findFreePort()));
+ hiveConf.setLongVar(ConfVars.HIVE_SERVER2_MAX_START_ATTEMPTS, 3l);
+ hiveConf.setTimeVar(ConfVars.HIVE_SERVER2_SLEEP_INTERVAL_BETWEEN_START_ATTEMPTS, 10,
+ TimeUnit.SECONDS);
this.miniClusterType = miniClusterType;
this.useMiniKdc = useMiniKdc;
this.serverPrincipal = serverPrincipal;
http://git-wip-us.apache.org/repos/asf/hive/blob/a2131154/service/src/java/org/apache/hive/service/server/HiveServer2.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index 58e9aeb..590b1f3 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -544,6 +544,9 @@ public class HiveServer2 extends CompositeService {
LOG.info("Starting HiveServer2");
HiveConf hiveConf = new HiveConf();
maxAttempts = hiveConf.getLongVar(HiveConf.ConfVars.HIVE_SERVER2_MAX_START_ATTEMPTS);
+ long retrySleepIntervalMs = hiveConf
+ .getTimeVar(ConfVars.HIVE_SERVER2_SLEEP_INTERVAL_BETWEEN_START_ATTEMPTS,
+ TimeUnit.MILLISECONDS);
HiveServer2 server = null;
try {
// Initialize the pool before we start the server; don't start yet.
@@ -589,9 +592,9 @@ public class HiveServer2 extends CompositeService {
throw new Error("Max start attempts " + maxAttempts + " exhausted", throwable);
} else {
LOG.warn("Error starting HiveServer2 on attempt " + attempts
- + ", will retry in 60 seconds", throwable);
+ + ", will retry in " + retrySleepIntervalMs + "ms", throwable);
try {
- Thread.sleep(60L * 1000L);
+ Thread.sleep(retrySleepIntervalMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}