You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/07/15 07:21:00 UTC

[jira] [Work logged] (HIVE-26336) Hive JDBC Driver should respect JDBC DriverManager#loginTimeout

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

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

                Author: ASF GitHub Bot
            Created on: 15/Jul/22 07:20
            Start Date: 15/Jul/22 07:20
    Worklog Time Spent: 10m 
      Work Description: pan3793 commented on PR #3379:
URL: https://github.com/apache/hive/pull/3379#issuecomment-1185254554

   > Introduce new JDBC parameter `connectTimeout` w/ exsiting `socketTimeout`, ignore `DriverManager.loginTimeout`
   
   Implement it as we discussed before, but I found it not easy to add integration tests.
   
   The following tests are what I want to add at first, but finally, I realized it does not make sense, because JDBC always runs in async mode, a "sleep" query will not block server return the response immediately.
   
   ```
   @Test(expected = SocketTimeoutException.class)
     public void testThrowSocketTimeoutException() throws Exception {
       String url = miniHS2.getJdbcURL("default", "socketTimeout=5000");
       try (HiveConnection conn = (HiveConnection) DriverManager.getConnection(url)) {
         try (Statement stmt = conn.createStatement()) {
           stmt.executeQuery("SELECT reflect('java.lang.Thread', 'sleep', bigint(6000))");
         }
       }
     }
   
     @Test
     public void testConnectTimeoutDoesNotAffectSocketTime() throws Exception {
       String url = miniHS2.getJdbcURL("default", "connectTimeout=5000");
       try (HiveConnection conn = (HiveConnection) DriverManager.getConnection(url)) {
         try (Statement stmt = conn.createStatement()) {
           stmt.executeQuery("SELECT reflect('java.lang.Thread', 'sleep', bigint(6000))");
         }
       }
     }
   ```




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

    Worklog Id:     (was: 791273)
    Time Spent: 8h 20m  (was: 8h 10m)

> 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: 8h 20m
>  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.10#820010)