sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-1725: Sqoop2: Connector upgrade in 1.99.4 fails with delete configs
Date Thu, 13 Nov 2014 23:02:39 GMT
Repository: sqoop
Updated Branches:
  refs/heads/branch-1.99.4 fbdd940eb -> 05711d141


SQOOP-1725: Sqoop2: Connector upgrade in 1.99.4 fails with delete configs

(Veena Basavaraj via Abraham Elmahrek)


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

Branch: refs/heads/branch-1.99.4
Commit: 05711d14118ab89861c45067b9680d0eaaeb52bb
Parents: fbdd940
Author: Abraham Elmahrek <abraham@elmahrek.com>
Authored: Thu Nov 13 14:57:06 2014 -0800
Committer: Abraham Elmahrek <abraham@elmahrek.com>
Committed: Thu Nov 13 14:57:06 2014 -0800

----------------------------------------------------------------------
 .../sqoop/repository/derby/DerbyRepositoryHandler.java  |  7 ++++++-
 .../derby/DerbySchemaInsertUpdateDeleteSelectQuery.java | 12 ++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/05711d14/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
index 37766bf..aa3a1e4 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbyRepositoryHandler.java
@@ -1294,11 +1294,14 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler
{
   private void updateConnectorAndDeleteConfigs(MConnector mConnector, Connection conn) {
     PreparedStatement updateConnectorStatement = null;
     PreparedStatement deleteConfig = null;
+    PreparedStatement deleteConfigDirection = null;
     PreparedStatement deleteInput = null;
     try {
       updateConnectorStatement = conn.prepareStatement(STMT_UPDATE_CONFIGURABLE);
       deleteInput = conn.prepareStatement(STMT_DELETE_INPUTS_FOR_CONFIGURABLE);
+      deleteConfigDirection = conn.prepareStatement(STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE);
       deleteConfig = conn.prepareStatement(STMT_DELETE_CONFIGS_FOR_CONFIGURABLE);
+      
       updateConnectorStatement.setString(1, mConnector.getUniqueName());
       updateConnectorStatement.setString(2, mConnector.getClassName());
       updateConnectorStatement.setString(3, mConnector.getVersion());
@@ -1309,15 +1312,17 @@ public class DerbyRepositoryHandler extends JdbcRepositoryHandler
{
         throw new SqoopException(DerbyRepoError.DERBYREPO_0038);
       }
       deleteInput.setLong(1, mConnector.getPersistenceId());
+      deleteConfigDirection.setLong(1, mConnector.getPersistenceId());
       deleteConfig.setLong(1, mConnector.getPersistenceId());
       deleteInput.executeUpdate();
+      deleteConfigDirection.executeUpdate();
       deleteConfig.executeUpdate();
 
     } catch (SQLException e) {
       logException(e, mConnector);
       throw new SqoopException(DerbyRepoError.DERBYREPO_0038, e);
     } finally {
-      closeStatements(updateConnectorStatement, deleteConfig, deleteInput);
+      closeStatements(updateConnectorStatement, deleteConfig, deleteConfigDirection, deleteInput);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/05711d14/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaInsertUpdateDeleteSelectQuery.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaInsertUpdateDeleteSelectQuery.java
b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaInsertUpdateDeleteSelectQuery.java
index a50027c..f349a75 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaInsertUpdateDeleteSelectQuery.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaInsertUpdateDeleteSelectQuery.java
@@ -628,6 +628,18 @@ public final class DerbySchemaInsertUpdateDeleteSelectQuery {
    public static final String STMT_SELECT_SQ_CONFIG_DIRECTIONS =
       STMT_SELECT_SQ_CONFIG_DIRECTIONS_ALL + " WHERE "
           + COLUMN_SQ_CFG_DIR_CONFIG + " = ?";
+   
+   // Delete the config directions for a connector
+   public static final String STMT_DELETE_DIRECTIONS_FOR_CONFIGURABLE =
+    "DELETE FROM " + TABLE_SQ_CONFIG_DIRECTIONS
+    + " WHERE "
+    + COLUMN_SQ_CFG_DIR_CONFIG
+    + " IN (SELECT "
+    + COLUMN_SQ_CFG_ID
+    + " FROM " + TABLE_SQ_CONFIG
+    + " WHERE "
+    + COLUMN_SQ_CFG_CONFIGURABLE + " = ?)";
+
 
 
   private DerbySchemaInsertUpdateDeleteSelectQuery() {


Mime
View raw message