diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java index 26d4d97..1315813 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java @@ -43,9 +43,9 @@ private CuratorFramework zkClient = null; private int zkPort = -1; private ZooKeeperTokenStore ts; - // connect timeout large enough for slower test environments - private final int connectTimeoutMillis = 30000; - private final int sessionTimeoutMillis = 3000; + private final int connectTimeoutMillis = CuratorFrameworkFactory.builder() + .getConnectionTimeoutMs(); + private final int sessionTimeoutMillis = CuratorFrameworkFactory.builder().getSessionTimeoutMs(); @Override protected void setUp() throws Exception { diff --git a/jdbc/src/java/org/apache/hive/jdbc/Utils.java b/jdbc/src/java/org/apache/hive/jdbc/Utils.java index 3ed933a..a27a532 100644 --- a/jdbc/src/java/org/apache/hive/jdbc/Utils.java +++ b/jdbc/src/java/org/apache/hive/jdbc/Utils.java @@ -100,9 +100,6 @@ static final String ZOOKEEPER_DEFAULT_NAMESPACE = "hiveserver2"; // Non-configurable params: - // ZOOKEEPER_SESSION_TIMEOUT is not exposed as client configurable - static final int ZOOKEEPER_SESSION_TIMEOUT = 600 * 1000; - static final int ZOOKEEPER_CONNECTION_TIMEOUT = -1; // Currently supports JKS keystore format static final String SSL_TRUST_STORE_TYPE = "JKS"; diff --git a/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java b/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java index d515ce5..0ac484d 100644 --- a/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java +++ b/jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java @@ -63,8 +63,8 @@ static String getNextServerUriFromZooKeeper(JdbcConnectionParams connParams) String serverNode; CuratorFramework zooKeeperClient = CuratorFrameworkFactory.builder().connectString(zooKeeperEnsemble) - .sessionTimeoutMs(JdbcConnectionParams.ZOOKEEPER_SESSION_TIMEOUT) - .connectionTimeoutMs(JdbcConnectionParams.ZOOKEEPER_CONNECTION_TIMEOUT) + .sessionTimeoutMs(CuratorFrameworkFactory.builder().getSessionTimeoutMs()) + .connectionTimeoutMs(CuratorFrameworkFactory.builder().getConnectionTimeoutMs()) .retryPolicy(new ExponentialBackoffRetry(1000, 3)).build(); zooKeeperClient.start(); try { 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 b814e4b..bb45942 100644 --- a/service/src/java/org/apache/hive/service/server/HiveServer2.java +++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java @@ -145,7 +145,6 @@ public static boolean isHTTPTransportMode(HiveConf hiveConf) { private void addServerInstanceToZooKeeper(HiveConf hiveConf) throws Exception { int zooKeeperSessionTimeout = hiveConf.getIntVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_SESSION_TIMEOUT); - int connectTimeoutMillis = -1; String zooKeeperEnsemble = ZooKeeperHiveHelper.getQuorumServers(hiveConf); String rootNamespace = hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_ZOOKEEPER_NAMESPACE); String instanceURI = getServerInstanceURI(hiveConf); @@ -155,7 +154,8 @@ private void addServerInstanceToZooKeeper(HiveConf hiveConf) throws Exception { // Use the zooKeeperAclProvider to create appropriate ACLs zooKeeperClient = CuratorFrameworkFactory.builder().connectString(zooKeeperEnsemble) - .sessionTimeoutMs(zooKeeperSessionTimeout).connectionTimeoutMs(connectTimeoutMillis) + .sessionTimeoutMs(zooKeeperSessionTimeout) + .connectionTimeoutMs(CuratorFrameworkFactory.builder().getConnectionTimeoutMs()) .aclProvider(zooKeeperAclProvider).retryPolicy(new ExponentialBackoffRetry(1000, 3)) .build(); zooKeeperClient.start(); diff --git a/shims/common-secure/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java b/shims/common-secure/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java index 16a52e4..37510e3 100644 --- a/shims/common-secure/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java +++ b/shims/common-secure/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java @@ -63,7 +63,7 @@ private volatile CuratorFramework zkSession; private String zkConnectString; private final int zkSessionTimeout = 3000; - private int connectTimeoutMillis = -1; + private int connectTimeoutMillis = CuratorFrameworkFactory.builder().getConnectionTimeoutMs(); private List newNodeAcl = Arrays.asList(new ACL(Perms.ALL, Ids.AUTH_IDS)); /**