Review Board 1.7.22


SQOOP-997 provide ability to disable the automatic upgrade for connectors and framework.

Review Request #12218 - Created July 2, 2013 and submitted

Mengwei Ding
SQOOP-997
Reviewers
Sqoop
abe, hshreedharan, jarcec
sqoop-sqoop2
commit bfd2a7d35c83cdbf3e21c64ea77fcec41b258b9a
Author: Mengwei Ding <mengwei.ding@cloudera.com>
Date:   Mon Jul 1 17:19:27 2013 -0700

    SQOOP-997 provide ability to disable the automatic upgrade for connectors and framework.

:100644 100644 0540f6b... fa91d02... M	core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java
:100644 100644 838aaaf... f225fcb... M	core/src/main/java/org/apache/sqoop/core/ConfigurationConstants.java
:100644 100644 a81306b... ad6cd0f... M	core/src/main/java/org/apache/sqoop/framework/FrameworkManager.java
:100644 100644 aa1aa8d... 2d9bf4e... M	core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java
:100644 100644 306bd90... 46cb7e6... M	core/src/main/java/org/apache/sqoop/repository/Repository.java
:100644 100644 ab5e5a1... c616889... M	core/src/main/java/org/apache/sqoop/repository/RepositoryError.java
:100755 100755 07b148e... 76596b4... M	dist/src/main/server/conf/sqoop.properties

 
core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java
Revision 0540f6b New Change
[20] 51 lines
[+20] [+] public class ConnectorManager implements Reconfigurable {
52
   * Private instance to singleton of this class.
52
   * Private instance to singleton of this class.
53
   */
53
   */
54
  private static ConnectorManager instance;
54
  private static ConnectorManager instance;
55

    
   
55

   
56
  /**
56
  /**

    
   
57
   * Default connector auto upgrade option value

    
   
58
   */

    
   
59
  private static boolean DEFAULT_AUTO_UPGRADE = false;

    
   
60

   

    
   
61
  /**
57
   * Create default object by default.
62
   * Create default object by default.
58
   *
63
   *
59
   * Every Sqoop server application needs one so this should not be performance issue.
64
   * Every Sqoop server application needs one so this should not be performance issue.
60
   */
65
   */
61
  static {
66
  static {
[+20] [20] 121 lines
[+20] [+] public synchronized void initialize() {
183
      }
188
      }
184
    } catch (IOException ex) {
189
    } catch (IOException ex) {
185
      throw new SqoopException(ConnectorError.CONN_0001, ex);
190
      throw new SqoopException(ConnectorError.CONN_0001, ex);
186
    }
191
    }
187

    
   
192

   
188
    registerConnectors();
193
    boolean autoUpgrade = SqoopConfiguration.getInstance().getContext().getBoolean(

    
   
194
        ConfigurationConstants.CONNECTOR_AUTO_UPGRADE, DEFAULT_AUTO_UPGRADE);

    
   
195
    registerConnectors(autoUpgrade);
189

    
   
196

   
190
    SqoopConfiguration.getInstance().getProvider().registerListener(new CoreConfigurationListener(this));
197
    SqoopConfiguration.getInstance().getProvider().registerListener(new CoreConfigurationListener(this));
191

    
   
198

   
192
    if (LOG.isInfoEnabled()) {
199
    if (LOG.isInfoEnabled()) {
193
      LOG.info("Connectors loaded: " + handlerMap);
200
      LOG.info("Connectors loaded: " + handlerMap);
194
    }
201
    }
195
  }
202
  }
196

    
   
203

   
197
  private synchronized void registerConnectors() {
204
  private synchronized void registerConnectors(boolean autoUpgrade) {
198
    Repository repository = RepositoryManager.getInstance().getRepository();
205
    Repository repository = RepositoryManager.getInstance().getRepository();
199

    
   
206

   
200
    RepositoryTransaction rtx = null;
207
    RepositoryTransaction rtx = null;
201
    try {
208
    try {
202
      rtx = repository.getTransaction();
209
      rtx = repository.getTransaction();
203
      rtx.begin();
210
      rtx.begin();
204
      for (String name : handlerMap.keySet()) {
211
      for (String name : handlerMap.keySet()) {
205
        ConnectorHandler handler = handlerMap.get(name);
212
        ConnectorHandler handler = handlerMap.get(name);
206
        MConnector connectorMetadata = handler.getMetadata();
213
        MConnector connectorMetadata = handler.getMetadata();
207
        MConnector registeredMetadata =
214
        MConnector registeredMetadata =
208
            repository.registerConnector(connectorMetadata);
215
            repository.registerConnector(connectorMetadata, autoUpgrade);
209

    
   
216

   
210
        // Set registered metadata instead of connector metadata as they will
217
        // Set registered metadata instead of connector metadata as they will
211
        // have filled persistent ids. We should be confident at this point that
218
        // have filled persistent ids. We should be confident at this point that
212
        // there are no differences between those two structures.
219
        // there are no differences between those two structures.
213
        handler.setMetadata(registeredMetadata);
220
        handler.setMetadata(registeredMetadata);
[+20] [20] 35 lines
core/src/main/java/org/apache/sqoop/core/ConfigurationConstants.java
Revision 838aaaf New Change
 
core/src/main/java/org/apache/sqoop/framework/FrameworkManager.java
Revision a81306b New Change
 
core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java
Revision aa1aa8d New Change
 
core/src/main/java/org/apache/sqoop/repository/Repository.java
Revision 306bd90 New Change
 
core/src/main/java/org/apache/sqoop/repository/RepositoryError.java
Revision ab5e5a1 New Change
 
dist/src/main/server/conf/sqoop.properties
Revision 07b148e New Change
 
  1. core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java: Loading...
  2. core/src/main/java/org/apache/sqoop/core/ConfigurationConstants.java: Loading...
  3. core/src/main/java/org/apache/sqoop/framework/FrameworkManager.java: Loading...
  4. core/src/main/java/org/apache/sqoop/repository/JdbcRepository.java: Loading...
  5. core/src/main/java/org/apache/sqoop/repository/Repository.java: Loading...
  6. core/src/main/java/org/apache/sqoop/repository/RepositoryError.java: Loading...
  7. dist/src/main/server/conf/sqoop.properties: Loading...