diff --git beeline/src/main/resources/beeline-log4j2.xml beeline/src/main/resources/beeline-log4j2.xml index a64f55e..55ec0f5 100644 --- beeline/src/main/resources/beeline-log4j2.xml +++ beeline/src/main/resources/beeline-log4j2.xml @@ -34,6 +34,8 @@ + + - + \ No newline at end of file diff --git jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java index 2969bc6..5c68b45 100644 --- jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java +++ jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java @@ -205,16 +205,15 @@ private void openTransport() throws SQLException { .get(JdbcConnectionParams.AUTH_KERBEROS_AUTH_TYPE)); transport = isHttpTransportMode() ? createHttpTransport() : createBinaryTransport(); if (!transport.isOpen()) { - LOG.info("Will try to open client transport with JDBC Uri: " + jdbcUriString); + logZkDiscoveryMessage("Attempting to open client transport with JDBC Uri: " + jdbcUriString); transport.open(); + logZkDiscoveryMessage("Connected to JDBC Uri: " + jdbcUriString); } break; } catch (TTransportException e) { - LOG.info("Could not open client transport with JDBC Uri: " + jdbcUriString); // We'll retry till we exhaust all HiveServer2 nodes from ZooKeeper - if ((sessConfMap.get(JdbcConnectionParams.SERVICE_DISCOVERY_MODE) != null) - && (JdbcConnectionParams.SERVICE_DISCOVERY_MODE_ZOOKEEPER.equalsIgnoreCase(sessConfMap - .get(JdbcConnectionParams.SERVICE_DISCOVERY_MODE)))) { + if (isZkDynamicDiscoveryMode()) { + LOG.info("Could not open client transport with JDBC Uri: " + jdbcUriString); try { // Update jdbcUriString, host & port variables in connParams // Throw an exception if all HiveServer2 nodes have been exhausted, @@ -229,7 +228,6 @@ private void openTransport() throws SQLException { jdbcUriString = connParams.getJdbcUriString(); host = connParams.getHost(); port = connParams.getPort(); - LOG.info("Will retry opening client transport"); } else { LOG.info("Transport Used for JDBC connection: " + sessConfMap.get(JdbcConnectionParams.TRANSPORT_MODE)); @@ -651,6 +649,18 @@ private boolean isHttpTransportMode() { return false; } + private boolean isZkDynamicDiscoveryMode() { + return (sessConfMap.get(JdbcConnectionParams.SERVICE_DISCOVERY_MODE) != null) + && (JdbcConnectionParams.SERVICE_DISCOVERY_MODE_ZOOKEEPER.equalsIgnoreCase(sessConfMap + .get(JdbcConnectionParams.SERVICE_DISCOVERY_MODE))); + } + + private void logZkDiscoveryMessage(String message) { + if (isZkDynamicDiscoveryMode()) { + LOG.info(message); + } + } + /** * Lookup varName in sessConfMap, if its null or empty return the default * value varDefault