sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-934: JDBC Connection can timeout after import but before hive import
Date Thu, 20 Jun 2013 22:11:15 GMT
Updated Branches:
  refs/heads/trunk 92e94b911 -> 217e2af3f


SQOOP-934: JDBC Connection can timeout after import but before hive import

(Raghav Kumar Gautam via Jarek Jarcec Cecho)


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

Branch: refs/heads/trunk
Commit: 217e2af3f8aa0329d370240749afd01b1e36d1db
Parents: 92e94b9
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu Jun 20 15:10:36 2013 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Thu Jun 20 15:10:36 2013 -0700

----------------------------------------------------------------------
 src/java/org/apache/sqoop/hive/HiveImport.java            | 2 ++
 src/java/org/apache/sqoop/manager/ConnManager.java        | 8 ++++++++
 src/java/org/apache/sqoop/manager/GenericJdbcManager.java | 7 +++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/217e2af3/src/java/org/apache/sqoop/hive/HiveImport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/hive/HiveImport.java b/src/java/org/apache/sqoop/hive/HiveImport.java
index 02596a6..07a354b 100644
--- a/src/java/org/apache/sqoop/hive/HiveImport.java
+++ b/src/java/org/apache/sqoop/hive/HiveImport.java
@@ -179,6 +179,8 @@ public class HiveImport {
     }
 
     // generate the HQL statements to run.
+    // reset the connection as it might have timed out
+    connManager.discardConnection(true);
     TableDefWriter tableWriter = new TableDefWriter(options, connManager,
         inputTableName, outputTableName,
         configuration, !debugMode);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/217e2af3/src/java/org/apache/sqoop/manager/ConnManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/manager/ConnManager.java b/src/java/org/apache/sqoop/manager/ConnManager.java
index 32e736c..c9e05da 100644
--- a/src/java/org/apache/sqoop/manager/ConnManager.java
+++ b/src/java/org/apache/sqoop/manager/ConnManager.java
@@ -485,6 +485,14 @@ public abstract class ConnManager {
   public abstract Connection getConnection() throws SQLException;
 
   /**
+   * discard the database connection.
+   */
+  public void discardConnection(boolean doClose) {
+    throw new UnsupportedOperationException("No discard connection support "
+      + "for this database");
+  }
+
+  /**
    * @return a string identifying the driver class to load for this
    * JDBC connection type.
    */

http://git-wip-us.apache.org/repos/asf/sqoop/blob/217e2af3/src/java/org/apache/sqoop/manager/GenericJdbcManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/manager/GenericJdbcManager.java b/src/java/org/apache/sqoop/manager/GenericJdbcManager.java
index 233e546..2113a5f 100644
--- a/src/java/org/apache/sqoop/manager/GenericJdbcManager.java
+++ b/src/java/org/apache/sqoop/manager/GenericJdbcManager.java
@@ -65,9 +65,12 @@ public class GenericJdbcManager
    * connection first.
    * @param doClose if true, try to close the connection before forgetting it.
    */
-  protected void discardConnection(boolean doClose) throws SQLException {
+  public void discardConnection(boolean doClose) {
     if (doClose && hasOpenConnection()) {
-      this.connection.close();
+      try {
+        this.connection.close();
+      } catch(SQLException sqe) {
+      }
     }
 
     this.connection = null;


Mime
View raw message