[ 
https://issues.apache.org/jira/browse/HIVE-26336?focusedWorklogId=783324&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-783324
 ]

ASF GitHub Bot logged work on HIVE-26336:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Jun/22 11:02
            Start Date: 21/Jun/22 11:02
    Worklog Time Spent: 10m 
      Work Description: pvary commented on code in PR #3379:
URL: https://github.com/apache/hive/pull/3379#discussion_r902473928


##########
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java:
##########
@@ -1329,21 +1328,32 @@ private String getSessionValue(String varName, String 
varDefault) {
     return varValue;
   }
 
-  // use socketTimeout from jdbc connection url. Thrift timeout needs to be in 
millis
-  private void setupLoginTimeout() {
-    String socketTimeoutStr = 
sessConfMap.getOrDefault(JdbcConnectionParams.SOCKET_TIMEOUT, "0");
-    long timeOut = 0;
-    try {
-      timeOut = Long.parseLong(socketTimeoutStr);
-    } catch (NumberFormatException e) {
-      LOG.info("Failed to parse socketTimeout of value " + socketTimeoutStr);
-    }
-    if (timeOut > Integer.MAX_VALUE) {
-      loginTimeout = Integer.MAX_VALUE;
-    } else if (timeOut < 0) {
-      loginTimeout = 0;
+  // For loginTimeout, prefer to use loginTimeout (in milliseconds) from jdbc 
connection url, and
+  // fallback to use DriverManger#getLoginTimeout (in seconds).
+  // For socketTimeout, use socketTimeout (in milliseconds) from jdbc 
connection url if present.
+  private void setupTimeout() {
+    long _loginTimeout = 0;

Review Comment:
   That's the hardest part of the development. Coming up with good variable 
names 😄 
   `loginTimeoutFromConf` or `confLoginTimeout` or `parsedLoginTimeout` or 
`longLoginTimeout`?
   
   But if you have better ideas then I would happy to see them 😄 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 783324)
    Time Spent: 1h 10m  (was: 1h)

> Hive JDBC Driver should respect JDBC DriverManager#loginTimeout
> ---------------------------------------------------------------
>
>                 Key: HIVE-26336
>                 URL: https://issues.apache.org/jira/browse/HIVE-26336
>             Project: Hive
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 4.0.0-alpha-1
>            Reporter: Cheng Pan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Before HIVE-12371, the Hive JDBC Driver uses DriverManager#loginTimeout as 
> both connectTimeout and socketTimeout, which usually cause socket timeout 
> exceptions for users who use Hive JDBC Driver in Spring Boot project, because 
> Spring Boot will setLoginTimeout to 30s (default values).
> HIVE-12371 introduced a new parameter socketTimeout, and does not care about 
> DriverManager#loginTimeout anymore, I think it's not a correct solution.
> I think the for loginTimeout, prefer to use loginTimeout (in milliseconds) 
> from jdbc connection url, and fallback to use DriverManger#getLoginTimeout 
> (in seconds).
> For socketTimeout, use socketTimeout (in milliseconds) from jdbc connection 
> url if present.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to