hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jd...@apache.org
Subject [36/51] [abbrv] hive git commit: HIVE-12481: Occasionally "Request is a replay" will be thrown from HS2 (Reviewed by Yongzhi Chen)
Date Thu, 17 Mar 2016 22:47:40 GMT
HIVE-12481: Occasionally "Request is a replay" will be thrown from HS2 (Reviewed by Yongzhi
Chen)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/e7a17566
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/e7a17566
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/e7a17566

Branch: refs/heads/llap
Commit: e7a17566314595578ae85a578d8abace4102b6d7
Parents: d4c1fdc
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Wed Mar 2 17:28:26 2016 -0500
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Mon Mar 14 16:19:50 2016 -0400

----------------------------------------------------------------------
 .../org/apache/hive/jdbc/HiveConnection.java     | 19 +++++++++++++++++--
 jdbc/src/java/org/apache/hive/jdbc/Utils.java    |  4 ++++
 2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e7a17566/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
index 873f421..352744f 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
@@ -63,6 +63,7 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManagerFactory;
 import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslException;
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
@@ -176,6 +177,13 @@ public class HiveConnection implements java.sql.Connection {
   }
 
   private void openTransport() throws SQLException {
+    int numRetries = 0;
+    int maxRetries = 1;
+    try {
+      maxRetries = Integer.parseInt(sessConfMap.get(JdbcConnectionParams.RETRIES));
+    } catch(NumberFormatException e) {
+    }
+
     while (true) {
       try {
         assumeSubject =
@@ -208,8 +216,15 @@ public class HiveConnection implements java.sql.Connection {
         } else {
           LOG.info("Transport Used for JDBC connection: " +
             sessConfMap.get(JdbcConnectionParams.TRANSPORT_MODE));
-          throw new SQLException("Could not open client transport with JDBC Uri: " + jdbcUriString
-              + ": " + e.getMessage(), " 08S01", e);
+
+          // Retry maxRetries times
+          String errMsg = "Could not open client transport with JDBC Uri: " +
+              jdbcUriString + ": " + e.getMessage();
+          if (++numRetries >= maxRetries) {
+            throw new SQLException(errMsg, " 08S01", e);
+          } else {
+            LOG.warn(errMsg + " Retrying " + numRetries + " of " + maxRetries);
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/e7a17566/jdbc/src/java/org/apache/hive/jdbc/Utils.java
----------------------------------------------------------------------
diff --git a/jdbc/src/java/org/apache/hive/jdbc/Utils.java b/jdbc/src/java/org/apache/hive/jdbc/Utils.java
index 080e8fc..754f89f 100644
--- a/jdbc/src/java/org/apache/hive/jdbc/Utils.java
+++ b/jdbc/src/java/org/apache/hive/jdbc/Utils.java
@@ -72,6 +72,10 @@ class Utils {
     // client side params are specified in sess_var_list
 
     // Client param names:
+
+    // Retry setting
+    static final String RETRIES = "retries";
+
     static final String AUTH_TYPE = "auth";
     // We're deprecating this variable's name.
     static final String AUTH_QOP_DEPRECATED = "sasl.qop";


Mime
View raw message