hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Vary (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HIVE-2444) Add TCP keepalive option for the hive jdbc driver
Date Tue, 30 May 2017 09:56:04 GMT

     [ https://issues.apache.org/jira/browse/HIVE-2444?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Peter Vary resolved HIVE-2444.
------------------------------
       Resolution: Fixed
    Fix Version/s: 1.1.0

Solved by HIVE-8829.

If the problem still exists please feel free to reopen

> Add TCP keepalive option for the hive jdbc driver
> -------------------------------------------------
>
>                 Key: HIVE-2444
>                 URL: https://issues.apache.org/jira/browse/HIVE-2444
>             Project: Hive
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 0.7.1
>            Reporter: Bob Tiernay
>             Fix For: 1.1.0
>
>
> When issuing long running jdbc queries it is quite plausibe that due to stateful firewall
rules connections may be dropped due to inactivity. Having the ability specify this as a jdbc
property would help alleviate this issue when firewall connection inactivity timeouts are
greater than the tcp keepalive time (default of 2 hrs). 
> As a temporary workaround, one can use reflection on the jdbc connection to set this
option:
> {code}
>     public static Connection getHiveConnection() {
>         Connection hiveConnection = // create connection
>         try {
>             Socket socket = getConnectionSocket( hiveConnection );
>             socket.setKeepAlive( true );
>         } catch( SocketException e ) {
>             throw new RuntimeException( e );
>         }
>         return hiveConnection;
>     }
>     private static Socket getConnectionSocket( Connection connection ) {
>         final Field fields[] = connection.getClass().getDeclaredFields();
>         for( int i = 0; i < fields.length; ++i ) {
>             if( "transport".equals( fields[i].getName() ) ) {
>                 try {
>                     fields[i].setAccessible( true );
>                     TSocket transport = (TSocket) fields[i].get( connection );
>                     return transport.getSocket();
>                 } catch( Exception e ) {
>                     throw new RuntimeException( e );
>                 }
>             }
>         }
>         return null;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message