Review Board 1.7.22


SQOOP-789. Fix Hadoop-1 build

Review Request #8666 - Created Dec. 18, 2012 and submitted

Hari Shreedharan
sqoop2
SQOOP-789
Reviewers
Sqoop
sqoop-sqoop2
Fix Hadoop-1 build
Did full build, both complete successfully.
execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java
Revision 9714167 New Change
[20] 50 lines
[+20] [+] public class SqoopOutputFormatLoadExecutor {
51
  private JobContext context;
51
  private JobContext context;
52
  private SqoopRecordWriter producer;
52
  private SqoopRecordWriter producer;
53
  private Future<?> consumerFuture;
53
  private Future<?> consumerFuture;
54
  private Semaphore filled = new Semaphore(0, true);
54
  private Semaphore filled = new Semaphore(0, true);
55
  private Semaphore free = new Semaphore(1, true);
55
  private Semaphore free = new Semaphore(1, true);

    
   
56
  private volatile boolean isTest = false;

    
   
57
  private String loaderName;

    
   
58

   

    
   
59
  SqoopOutputFormatLoadExecutor(boolean isTest, String loaderName){

    
   
60
    this.isTest = isTest;

    
   
61
    this.loaderName = loaderName;

    
   
62
    data = new Data();

    
   
63
    producer = new SqoopRecordWriter();

    
   
64
  }
56

    
   
65

   
57
  public SqoopOutputFormatLoadExecutor(JobContext jobctx) {
66
  public SqoopOutputFormatLoadExecutor(JobContext jobctx) {
58
    data = new Data();
67
    data = new Data();
59
    context = jobctx;
68
    context = jobctx;
60
    producer = new SqoopRecordWriter();
69
    producer = new SqoopRecordWriter();
[+20] [20] 105 lines
[+20] [+] public Object readContent(int type) throws InterruptedException {
166

    
   
175

   
167
    @Override
176
    @Override
168
    public void run() {
177
    public void run() {
169
      DataReader reader = new OutputFormatDataReader();
178
      DataReader reader = new OutputFormatDataReader();
170

    
   
179

   
171
      Configuration conf = context.getConfiguration();
180
      Configuration conf = null;

    
   
181
      if (!isTest) {

    
   
182
        conf = context.getConfiguration();
172

    
   
183

   
173

    
   
184

   
174
      String loaderName = conf.get(JobConstants.JOB_ETL_LOADER);
185
        loaderName = conf.get(JobConstants.JOB_ETL_LOADER);

    
   
186
      }
175
      Loader loader = (Loader) ClassUtils.instantiate(loaderName);
187
      Loader loader = (Loader) ClassUtils.instantiate(loaderName);
176

    
   
188

   
177
      // Objects that should be pass to the Executor execution
189
      // Objects that should be pass to the Executor execution
178
      PrefixContext subContext = null;
190
      PrefixContext subContext = null;
179
      Object configConnection = null;
191
      Object configConnection = null;
180
      Object configJob = null;
192
      Object configJob = null;
181

    
   
193

   

    
   
194
      if (!isTest) {
182
      switch (ConfigurationUtils.getJobType(conf)) {
195
        switch (ConfigurationUtils.getJobType(conf)) {
183
        case EXPORT:
196
          case EXPORT:
184
          subContext = new PrefixContext(conf, JobConstants.PREFIX_CONNECTOR_CONTEXT);
197
            subContext = new PrefixContext(conf, JobConstants.PREFIX_CONNECTOR_CONTEXT);
185
          configConnection = ConfigurationUtils.getConnectorConnection(conf);
198
            configConnection = ConfigurationUtils.getConnectorConnection(conf);
186
          configJob = ConfigurationUtils.getConnectorJob(conf);
199
            configJob = ConfigurationUtils.getConnectorJob(conf);
[+20] [20] 8 lines
[+20] public void run() {
195
          // Release so that the writer can tell the framework something went
208
            // Release so that the writer can tell the framework something went
196
          // wrong.
209
            // wrong.
197
          free.release();
210
            free.release();
198
          throw new SqoopException(MapreduceExecutionError.MAPRED_EXEC_0023);
211
            throw new SqoopException(MapreduceExecutionError.MAPRED_EXEC_0023);
199
      }
212
        }

    
   
213
      }
200

    
   
214

   
201
      try {
215
      try {
202
        LOG.info("Running loader class " + loaderName);
216
        LOG.info("Running loader class " + loaderName);
203
        loader.load(subContext, configConnection, configJob, reader);
217
        loader.load(subContext, configConnection, configJob, reader);
204
        LOG.info("Loader has finished");
218
        LOG.info("Loader has finished");
[+20] [20] 26 lines
execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java
Revision 4234adf New Change
 
  1. execution/mapreduce/src/main/java/org/apache/sqoop/job/mr/SqoopOutputFormatLoadExecutor.java: Loading...
  2. execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java: Loading...