You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by sz...@apache.org on 2012/02/04 04:40:56 UTC
svn commit: r1240450 [4/6] - in
/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project: ./ bin/
conf/
hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/
hadoop-mapreduce-client/hadoop...
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorBaseDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorBaseDescriptor.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorBaseDescriptor.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorBaseDescriptor.java Sat Feb 4 03:40:45 2012
@@ -28,12 +28,7 @@ import org.apache.hadoop.mapred.JobConf;
/**
* This class implements the common functionalities of
* the subclasses of ValueAggregatorDescriptor class.
- *
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorBaseDescriptor}
- * instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueAggregatorBaseDescriptor extends org.apache.hadoop.mapreduce.
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorCombiner.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorCombiner.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorCombiner.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorCombiner.java Sat Feb 4 03:40:45 2012
@@ -32,11 +32,7 @@ import org.apache.hadoop.mapred.Reporter
/**
* This class implements the generic combiner of Aggregate.
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorCombiner}
- * instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueAggregatorCombiner<K1 extends WritableComparable,
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorDescriptor.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorDescriptor.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorDescriptor.java Sat Feb 4 03:40:45 2012
@@ -33,12 +33,7 @@ import org.apache.hadoop.mapred.JobConf;
* ValueAggregatorDescriptor objects at configuration time. For each input
* key/value pair, the mapper will use those objects to create aggregation
* id/value pairs.
- *
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorDescriptor}
- * instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public interface ValueAggregatorDescriptor extends
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java Sat Feb 4 03:40:45 2012
@@ -78,11 +78,7 @@ import org.apache.hadoop.util.GenericOpt
* framework. The function takes the following parameters: input directory spec
* input format (text or sequence file) output directory a file specifying the
* user plugin class
- *
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorJob} instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueAggregatorJob {
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJobBase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJobBase.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJobBase.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJobBase.java Sat Feb 4 03:40:45 2012
@@ -33,11 +33,7 @@ import org.apache.hadoop.mapred.Reducer;
/**
* This abstract class implements some common functionalities of the
* the generic mapper, reducer and combiner classes of Aggregate.
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorJobBase}
- * instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class ValueAggregatorJobBase<K1 extends WritableComparable,
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorMapper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorMapper.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorMapper.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorMapper.java Sat Feb 4 03:40:45 2012
@@ -32,11 +32,7 @@ import org.apache.hadoop.mapred.Reporter
/**
* This class implements the generic mapper of Aggregate.
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorMapper}
- * instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueAggregatorMapper<K1 extends WritableComparable,
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorReducer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorReducer.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorReducer.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorReducer.java Sat Feb 4 03:40:45 2012
@@ -31,12 +31,7 @@ import org.apache.hadoop.mapred.Reporter
/**
* This class implements the generic reducer of Aggregate.
- *
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueAggregatorReducer}
- * instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueAggregatorReducer<K1 extends WritableComparable,
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueHistogram.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueHistogram.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueHistogram.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/aggregate/ValueHistogram.java Sat Feb 4 03:40:45 2012
@@ -24,11 +24,7 @@ import org.apache.hadoop.classification.
/**
* This class implements a value aggregator that computes the
* histogram of a sequence of strings.
- *
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.aggregate.ValueHistogram} instead
*/
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueHistogram
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBConfiguration.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBConfiguration.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBConfiguration.java Sat Feb 4 03:40:45 2012
@@ -22,11 +22,6 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.mapred.JobConf;
-/**
- * @deprecated Use
- * {@link org.apache.hadoop.mapreduce.lib.db.DBConfiguration} instead
- */
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class DBConfiguration extends
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBInputFormat.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBInputFormat.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBInputFormat.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBInputFormat.java Sat Feb 4 03:40:45 2012
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.InputFormat;
@@ -36,11 +35,6 @@ import org.apache.hadoop.mapred.RecordRe
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapreduce.Job;
-/**
- * @deprecated
- * Use {@link org.apache.hadoop.mapreduce.lib.db.DBInputFormat} instead.
- */
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class DBInputFormat<T extends DBWritable>
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java Sat Feb 4 03:40:45 2012
@@ -31,15 +31,10 @@ import org.apache.hadoop.mapred.OutputFo
import org.apache.hadoop.mapred.RecordWriter;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapreduce.MRJobConfig;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
import org.apache.hadoop.util.Progressable;
-/**
- * @deprecated Use org.apache.hadoop.mapreduce.lib.db.DBOutputFormat instead
- */
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public class DBOutputFormat<K extends DBWritable, V>
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBWritable.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBWritable.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/db/DBWritable.java Sat Feb 4 03:40:45 2012
@@ -20,11 +20,6 @@ package org.apache.hadoop.mapred.lib.db;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
-/**
- * @deprecated
- * Use {@link org.apache.hadoop.mapreduce.lib.db.DBWritable} instead
- */
-@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Stable
public interface DBWritable
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Application.java Sat Feb 4 03:40:45 2012
@@ -18,7 +18,6 @@
package org.apache.hadoop.mapred.pipes;
-import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
@@ -27,14 +26,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Random;
+
import javax.crypto.SecretKey;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.mapreduce.MRJobConfig;
-import org.apache.hadoop.mapreduce.filecache.DistributedCache;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
@@ -50,6 +47,8 @@ import org.apache.hadoop.mapred.RecordRe
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TaskAttemptID;
import org.apache.hadoop.mapred.TaskLog;
+import org.apache.hadoop.mapreduce.MRJobConfig;
+import org.apache.hadoop.mapreduce.filecache.DistributedCache;
import org.apache.hadoop.mapreduce.security.SecureShuffleUtils;
import org.apache.hadoop.mapreduce.security.TokenCache;
import org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier;
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/BinaryProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/BinaryProtocol.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/BinaryProtocol.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/BinaryProtocol.java Sat Feb 4 03:40:45 2012
@@ -18,14 +18,20 @@
package org.apache.hadoop.mapred.pipes;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.FileOutputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.crypto.SecretKey;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.BytesWritable;
@@ -36,8 +42,6 @@ import org.apache.hadoop.io.WritableComp
import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
-import org.apache.hadoop.mapreduce.security.SecureShuffleUtils;
-import org.apache.hadoop.mapreduce.security.token.JobTokenSecretManager;
import org.apache.hadoop.util.StringUtils;
/**
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/OutputHandler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/OutputHandler.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/OutputHandler.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/OutputHandler.java Sat Feb 4 03:40:45 2012
@@ -19,9 +19,7 @@
package org.apache.hadoop.mapred.pipes;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.apache.hadoop.io.FloatWritable;
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Submitter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Submitter.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Submitter.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/pipes/Submitter.java Sat Feb 4 03:40:45 2012
@@ -25,7 +25,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.util.Iterator;
import java.util.StringTokenizer;
import org.apache.commons.cli.BasicParser;
@@ -41,8 +40,6 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.mapreduce.MRJobConfig;
-import org.apache.hadoop.mapreduce.filecache.DistributedCache;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
@@ -59,6 +56,8 @@ import org.apache.hadoop.mapred.RunningJ
import org.apache.hadoop.mapred.lib.HashPartitioner;
import org.apache.hadoop.mapred.lib.LazyOutputFormat;
import org.apache.hadoop.mapred.lib.NullOutputFormat;
+import org.apache.hadoop.mapreduce.MRJobConfig;
+import org.apache.hadoop.mapreduce.filecache.DistributedCache;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.Tool;
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java Sat Feb 4 03:40:45 2012
@@ -369,6 +369,12 @@ class JobSubmitter {
conf.set(toFullPropertyName(queue,
QueueACL.ADMINISTER_JOBS.getAclName()), acl.getAclString());
+ // removing jobtoken referrals before copying the jobconf to HDFS
+ // as the tasks don't need this setting, actually they may break
+ // because of it if present as the referral will point to a
+ // different job.
+ TokenCache.cleanUpTokenReferral(conf);
+
// Write job file to submit dir
writeConf(conf, submitJobFile);
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/OutputCommitter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/OutputCommitter.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/OutputCommitter.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/OutputCommitter.java Sat Feb 4 03:40:45 2012
@@ -51,17 +51,21 @@ import org.apache.hadoop.classification.
* Discard the task commit.
* </li>
* </ol>
+ * The methods in this class can be called from several different processes and
+ * from several different contexts. It is important to know which process and
+ * which context each is called from. Each method should be marked accordingly
+ * in its documentation.
*
* @see org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
* @see JobContext
* @see TaskAttemptContext
- *
*/
@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class OutputCommitter {
/**
- * For the framework to setup the job output during initialization
+ * For the framework to setup the job output during initialization. This is
+ * called from the application master process for the entire job.
*
* @param jobContext Context of the job whose output is being written.
* @throws IOException if temporary output could not be created
@@ -69,11 +73,12 @@ public abstract class OutputCommitter {
public abstract void setupJob(JobContext jobContext) throws IOException;
/**
- * For cleaning up the job's output after job completion
+ * For cleaning up the job's output after job completion. This is called
+ * from the application master process for the entire job.
*
* @param jobContext Context of the job whose output is being written.
* @throws IOException
- * @deprecated Use {@link #commitJob(JobContext)} or
+ * @deprecated Use {@link #commitJob(JobContext)} and
* {@link #abortJob(JobContext, JobStatus.State)} instead.
*/
@Deprecated
@@ -81,7 +86,8 @@ public abstract class OutputCommitter {
/**
* For committing job's output after successful job completion. Note that this
- * is invoked for jobs with final runstate as SUCCESSFUL.
+ * is invoked for jobs with final runstate as SUCCESSFUL. This is called
+ * from the application master process for the entire job.
*
* @param jobContext Context of the job whose output is being written.
* @throws IOException
@@ -94,7 +100,8 @@ public abstract class OutputCommitter {
/**
* For aborting an unsuccessful job's output. Note that this is invoked for
* jobs with final runstate as {@link JobStatus.State#FAILED} or
- * {@link JobStatus.State#KILLED}.
+ * {@link JobStatus.State#KILLED}. This is called from the application
+ * master process for the entire job.
*
* @param jobContext Context of the job whose output is being written.
* @param state final runstate of the job
@@ -106,7 +113,8 @@ public abstract class OutputCommitter {
}
/**
- * Sets up output for the task.
+ * Sets up output for the task. This is called from each individual task's
+ * process that will output to HDFS, and it is called just for that task.
*
* @param taskContext Context of the task whose output is being written.
* @throws IOException
@@ -115,7 +123,9 @@ public abstract class OutputCommitter {
throws IOException;
/**
- * Check whether task needs a commit
+ * Check whether task needs a commit. This is called from each individual
+ * task's process that will output to HDFS, and it is called just for that
+ * task.
*
* @param taskContext
* @return true/false
@@ -125,18 +135,23 @@ public abstract class OutputCommitter {
throws IOException;
/**
- * To promote the task's temporary output to final output location
- *
- * The task's output is moved to the job's output directory.
+ * To promote the task's temporary output to final output location.
+ * If {@link #needsTaskCommit(TaskAttemptContext)} returns true and this
+ * task is the task that the AM determines finished first, this method
+ * is called to commit an individual task's output. This is to mark
+ * that tasks output as complete, as {@link #commitJob(JobContext)} will
+ * also be called later on if the entire job finished successfully. This
+ * is called from a task's process.
*
* @param taskContext Context of the task whose output is being written.
- * @throws IOException if commit is not
+ * @throws IOException if commit is not successful.
*/
public abstract void commitTask(TaskAttemptContext taskContext)
throws IOException;
/**
- * Discard the task output
+ * Discard the task output. This is called from a task's process to clean
+ * up a single task's output that can not yet been committed.
*
* @param taskContext
* @throws IOException
@@ -164,7 +179,8 @@ public abstract class OutputCommitter {
* The retry-count for the job will be passed via the
* {@link MRJobConfig#APPLICATION_ATTEMPT_ID} key in
* {@link TaskAttemptContext#getConfiguration()} for the
- * <code>OutputCommitter</code>.
+ * <code>OutputCommitter</code>. This is called from the application master
+ * process, but it is called individually for each task.
*
* If an exception is thrown the task will be attempted again.
*
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryParser.java Sat Feb 4 03:40:45 2012
@@ -24,8 +24,11 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -52,9 +55,13 @@ import org.apache.hadoop.yarn.api.record
@InterfaceStability.Unstable
public class JobHistoryParser {
+ private static final Log LOG = LogFactory.getLog(JobHistoryParser.class);
+
private final FSDataInputStream in;
- JobInfo info = null;
+ private JobInfo info = null;
+ private IOException parseException = null;
+
/**
* Create a job history parser for the given history file using the
* given file system
@@ -91,30 +98,58 @@ public class JobHistoryParser {
* The first invocation will populate the object, subsequent calls
* will return the already parsed object.
* The input stream is closed on return
+ *
+ * This api ignores partial records and stops parsing on encountering one.
+ * {@link #getParseException()} can be used to fetch the exception, if any.
+ *
* @return The populated jobInfo object
* @throws IOException
+ * @see #getParseException()
*/
public synchronized JobInfo parse() throws IOException {
+ return parse(new EventReader(in));
+ }
+
+ /**
+ * Only used for unit tests.
+ */
+ @Private
+ public synchronized JobInfo parse(EventReader reader) throws IOException {
if (info != null) {
return info;
}
- EventReader reader = new EventReader(in);
+ info = new JobInfo();
+ int eventCtr = 0;
HistoryEvent event;
- info = new JobInfo();
try {
while ((event = reader.getNextEvent()) != null) {
handleEvent(event);
- }
+ ++eventCtr;
+ }
+ } catch (IOException ioe) {
+ LOG.info("Caught exception parsing history file after " + eventCtr +
+ " events", ioe);
+ parseException = ioe;
} finally {
in.close();
}
return info;
}
- private void handleEvent(HistoryEvent event) throws IOException {
+ /**
+ * Get the parse exception, if any.
+ *
+ * @return the parse exception, if any
+ * @see #parse()
+ */
+ public synchronized IOException getParseException() {
+ return parseException;
+ }
+
+ private void handleEvent(HistoryEvent event) {
EventType type = event.getEventType();
switch (type) {
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java Sat Feb 4 03:40:45 2012
@@ -19,16 +19,16 @@
package org.apache.hadoop.mapreduce.lib.output;
import java.io.IOException;
-import java.net.URI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.JobStatus;
import org.apache.hadoop.mapreduce.MRJobConfig;
@@ -37,41 +37,239 @@ import org.apache.hadoop.mapreduce.TaskA
import org.apache.hadoop.mapreduce.TaskAttemptID;
/** An {@link OutputCommitter} that commits files specified
- * in job output directory i.e. ${mapreduce.output.fileoutputformat.outputdir}.
+ * in job output directory i.e. ${mapreduce.output.fileoutputformat.outputdir}.
**/
@InterfaceAudience.Public
@InterfaceStability.Stable
public class FileOutputCommitter extends OutputCommitter {
-
private static final Log LOG = LogFactory.getLog(FileOutputCommitter.class);
- /**
- * Temporary directory name
+ /**
+ * Name of directory where pending data is placed. Data that has not been
+ * committed yet.
*/
- protected static final String TEMP_DIR_NAME = "_temporary";
+ public static final String PENDING_DIR_NAME = "_temporary";
public static final String SUCCEEDED_FILE_NAME = "_SUCCESS";
- static final String SUCCESSFUL_JOB_OUTPUT_DIR_MARKER =
+ public static final String SUCCESSFUL_JOB_OUTPUT_DIR_MARKER =
"mapreduce.fileoutputcommitter.marksuccessfuljobs";
- private FileSystem outputFileSystem = null;
private Path outputPath = null;
private Path workPath = null;
/**
* Create a file output committer
- * @param outputPath the job's output path
+ * @param outputPath the job's output path, or null if you want the output
+ * committer to act as a noop.
* @param context the task's context
* @throws IOException
*/
public FileOutputCommitter(Path outputPath,
TaskAttemptContext context) throws IOException {
+ this(outputPath, (JobContext)context);
+ if (outputPath != null) {
+ workPath = getTaskAttemptPath(context, outputPath);
+ }
+ }
+
+ /**
+ * Create a file output committer
+ * @param outputPath the job's output path, or null if you want the output
+ * committer to act as a noop.
+ * @param context the task's context
+ * @throws IOException
+ */
+ @Private
+ public FileOutputCommitter(Path outputPath,
+ JobContext context) throws IOException {
if (outputPath != null) {
- this.outputPath = outputPath;
- outputFileSystem = outputPath.getFileSystem(context.getConfiguration());
- workPath = new Path(outputPath,
- getTaskAttemptBaseDirName(context))
- .makeQualified(outputFileSystem);
+ FileSystem fs = outputPath.getFileSystem(context.getConfiguration());
+ this.outputPath = fs.makeQualified(outputPath);
}
}
+
+ /**
+ * @return the path where final output of the job should be placed. This
+ * could also be considered the committed application attempt path.
+ */
+ private Path getOutputPath() {
+ return this.outputPath;
+ }
+
+ /**
+ * @return true if we have an output path set, else false.
+ */
+ private boolean hasOutputPath() {
+ return this.outputPath != null;
+ }
+
+ /**
+ * @return the path where the output of pending job attempts are
+ * stored.
+ */
+ private Path getPendingJobAttemptsPath() {
+ return getPendingJobAttemptsPath(getOutputPath());
+ }
+
+ /**
+ * Get the location of pending job attempts.
+ * @param out the base output directory.
+ * @return the location of pending job attempts.
+ */
+ private static Path getPendingJobAttemptsPath(Path out) {
+ return new Path(out, PENDING_DIR_NAME);
+ }
+
+ /**
+ * Get the Application Attempt Id for this job
+ * @param context the context to look in
+ * @return the Application Attempt Id for a given job.
+ */
+ private static int getAppAttemptId(JobContext context) {
+ return context.getConfiguration().getInt(
+ MRJobConfig.APPLICATION_ATTEMPT_ID, 0);
+ }
+
+ /**
+ * Compute the path where the output of a given job attempt will be placed.
+ * @param context the context of the job. This is used to get the
+ * application attempt id.
+ * @return the path to store job attempt data.
+ */
+ public Path getJobAttemptPath(JobContext context) {
+ return getJobAttemptPath(context, getOutputPath());
+ }
+
+ /**
+ * Compute the path where the output of a given job attempt will be placed.
+ * @param context the context of the job. This is used to get the
+ * application attempt id.
+ * @param out the output path to place these in.
+ * @return the path to store job attempt data.
+ */
+ public static Path getJobAttemptPath(JobContext context, Path out) {
+ return getJobAttemptPath(getAppAttemptId(context), out);
+ }
+
+ /**
+ * Compute the path where the output of a given job attempt will be placed.
+ * @param appAttemptId the ID of the application attempt for this job.
+ * @return the path to store job attempt data.
+ */
+ private Path getJobAttemptPath(int appAttemptId) {
+ return getJobAttemptPath(appAttemptId, getOutputPath());
+ }
+
+ /**
+ * Compute the path where the output of a given job attempt will be placed.
+ * @param appAttemptId the ID of the application attempt for this job.
+ * @return the path to store job attempt data.
+ */
+ private static Path getJobAttemptPath(int appAttemptId, Path out) {
+ return new Path(getPendingJobAttemptsPath(out), String.valueOf(appAttemptId));
+ }
+
+ /**
+ * Compute the path where the output of pending task attempts are stored.
+ * @param context the context of the job with pending tasks.
+ * @return the path where the output of pending task attempts are stored.
+ */
+ private Path getPendingTaskAttemptsPath(JobContext context) {
+ return getPendingTaskAttemptsPath(context, getOutputPath());
+ }
+
+ /**
+ * Compute the path where the output of pending task attempts are stored.
+ * @param context the context of the job with pending tasks.
+ * @return the path where the output of pending task attempts are stored.
+ */
+ private static Path getPendingTaskAttemptsPath(JobContext context, Path out) {
+ return new Path(getJobAttemptPath(context, out), PENDING_DIR_NAME);
+ }
+
+ /**
+ * Compute the path where the output of a task attempt is stored until
+ * that task is committed.
+ *
+ * @param context the context of the task attempt.
+ * @return the path where a task attempt should be stored.
+ */
+ public Path getTaskAttemptPath(TaskAttemptContext context) {
+ return new Path(getPendingTaskAttemptsPath(context),
+ String.valueOf(context.getTaskAttemptID()));
+ }
+
+ /**
+ * Compute the path where the output of a task attempt is stored until
+ * that task is committed.
+ *
+ * @param context the context of the task attempt.
+ * @param out The output path to put things in.
+ * @return the path where a task attempt should be stored.
+ */
+ public static Path getTaskAttemptPath(TaskAttemptContext context, Path out) {
+ return new Path(getPendingTaskAttemptsPath(context, out),
+ String.valueOf(context.getTaskAttemptID()));
+ }
+
+ /**
+ * Compute the path where the output of a committed task is stored until
+ * the entire job is committed.
+ * @param context the context of the task attempt
+ * @return the path where the output of a committed task is stored until
+ * the entire job is committed.
+ */
+ public Path getCommittedTaskPath(TaskAttemptContext context) {
+ return getCommittedTaskPath(getAppAttemptId(context), context);
+ }
+
+ public static Path getCommittedTaskPath(TaskAttemptContext context, Path out) {
+ return getCommittedTaskPath(getAppAttemptId(context), context, out);
+ }
+
+ /**
+ * Compute the path where the output of a committed task is stored until the
+ * entire job is committed for a specific application attempt.
+ * @param appAttemptId the id of the application attempt to use
+ * @param context the context of any task.
+ * @return the path where the output of a committed task is stored.
+ */
+ private Path getCommittedTaskPath(int appAttemptId, TaskAttemptContext context) {
+ return new Path(getJobAttemptPath(appAttemptId),
+ String.valueOf(context.getTaskAttemptID().getTaskID()));
+ }
+
+ private static Path getCommittedTaskPath(int appAttemptId, TaskAttemptContext context, Path out) {
+ return new Path(getJobAttemptPath(appAttemptId, out),
+ String.valueOf(context.getTaskAttemptID().getTaskID()));
+ }
+
+ private static class CommittedTaskFilter implements PathFilter {
+ @Override
+ public boolean accept(Path path) {
+ return !PENDING_DIR_NAME.equals(path.getName());
+ }
+ }
+
+ /**
+ * Get a list of all paths where output from committed tasks are stored.
+ * @param context the context of the current job
+ * @return the list of these Paths/FileStatuses.
+ * @throws IOException
+ */
+ private FileStatus[] getAllCommittedTaskPaths(JobContext context)
+ throws IOException {
+ Path jobAttemptPath = getJobAttemptPath(context);
+ FileSystem fs = jobAttemptPath.getFileSystem(context.getConfiguration());
+ return fs.listStatus(jobAttemptPath, new CommittedTaskFilter());
+ }
+
+ /**
+ * Get the directory that the task should write results into.
+ * @return the work directory
+ * @throws IOException
+ */
+ public Path getWorkPath() throws IOException {
+ return workPath;
+ }
/**
* Create the temporary directory that is the root of all of the task
@@ -79,116 +277,103 @@ public class FileOutputCommitter extends
* @param context the job's context
*/
public void setupJob(JobContext context) throws IOException {
- if (outputPath != null) {
- Path tmpDir = new Path(outputPath, getJobAttemptBaseDirName(context) +
- Path.SEPARATOR + FileOutputCommitter.TEMP_DIR_NAME);
- FileSystem fileSys = tmpDir.getFileSystem(context.getConfiguration());
- if (!fileSys.mkdirs(tmpDir)) {
- LOG.error("Mkdirs failed to create " + tmpDir.toString());
+ if (hasOutputPath()) {
+ Path pendingJobAttemptsPath = getPendingJobAttemptsPath();
+ FileSystem fs = pendingJobAttemptsPath.getFileSystem(
+ context.getConfiguration());
+ if (!fs.mkdirs(pendingJobAttemptsPath)) {
+ LOG.error("Mkdirs failed to create " + pendingJobAttemptsPath);
}
- }
- }
-
- // True if the job requires output.dir marked on successful job.
- // Note that by default it is set to true.
- private boolean shouldMarkOutputDir(Configuration conf) {
- return conf.getBoolean(SUCCESSFUL_JOB_OUTPUT_DIR_MARKER, true);
- }
-
- // Create a _success file in the job's output dir
- private void markOutputDirSuccessful(MRJobConfig context) throws IOException {
- if (outputPath != null) {
- // create a file in the output folder to mark the job completion
- Path filePath = new Path(outputPath, SUCCEEDED_FILE_NAME);
- outputFileSystem.create(filePath).close();
+ } else {
+ LOG.warn("Output Path is null in setupJob()");
}
}
/**
- * Move all job output to the final place.
+ * The job has completed so move all committed tasks to the final output dir.
* Delete the temporary directory, including all of the work directories.
* Create a _SUCCESS file to make it as successful.
* @param context the job's context
*/
public void commitJob(JobContext context) throws IOException {
- if (outputPath != null) {
- //delete the task temp directory from the current jobtempdir
- Path tmpDir = new Path(outputPath, getJobAttemptBaseDirName(context) +
- Path.SEPARATOR + FileOutputCommitter.TEMP_DIR_NAME);
- FileSystem fileSys = tmpDir.getFileSystem(context.getConfiguration());
- if (fileSys.exists(tmpDir)) {
- fileSys.delete(tmpDir, true);
- } else {
- LOG.warn("Task temp dir could not be deleted " + tmpDir);
+ if (hasOutputPath()) {
+ Path finalOutput = getOutputPath();
+ FileSystem fs = finalOutput.getFileSystem(context.getConfiguration());
+ for(FileStatus stat: getAllCommittedTaskPaths(context)) {
+ mergePaths(fs, stat, finalOutput);
}
- //move the job output to final place
- Path jobOutputPath =
- new Path(outputPath, getJobAttemptBaseDirName(context));
- moveJobOutputs(outputFileSystem, jobOutputPath, outputPath, jobOutputPath);
-
// delete the _temporary folder and create a _done file in the o/p folder
cleanupJob(context);
- if (shouldMarkOutputDir(context.getConfiguration())) {
- markOutputDirSuccessful(context);
+ // True if the job requires output.dir marked on successful job.
+ // Note that by default it is set to true.
+ if (context.getConfiguration().getBoolean(SUCCESSFUL_JOB_OUTPUT_DIR_MARKER, true)) {
+ Path markerPath = new Path(outputPath, SUCCEEDED_FILE_NAME);
+ fs.create(markerPath).close();
}
+ } else {
+ LOG.warn("Output Path is null in commitJob()");
}
}
/**
- * Move job output to final location
- * @param fs Filesystem handle
- * @param origJobOutputPath The original location of the job output
- * Required to generate the relative path for correct moving of data.
- * @param finalOutputDir The final output directory to which the job output
- * needs to be moved
- * @param jobOutput The current job output directory being moved
- * @throws IOException
- */
- private void moveJobOutputs(FileSystem fs, final Path origJobOutputPath,
- Path finalOutputDir, Path jobOutput) throws IOException {
- LOG.debug("Told to move job output from " + jobOutput
- + " to " + finalOutputDir +
- " and orig job output path is " + origJobOutputPath);
- if (fs.isFile(jobOutput)) {
- Path finalOutputPath =
- getFinalPath(finalOutputDir, jobOutput, origJobOutputPath);
- if (!fs.rename(jobOutput, finalOutputPath)) {
- if (!fs.delete(finalOutputPath, true)) {
- throw new IOException("Failed to delete earlier output of job");
- }
- if (!fs.rename(jobOutput, finalOutputPath)) {
- throw new IOException("Failed to save output of job");
- }
- }
- LOG.debug("Moved job output file from " + jobOutput + " to " +
- finalOutputPath);
- } else if (fs.getFileStatus(jobOutput).isDirectory()) {
- LOG.debug("Job output file " + jobOutput + " is a dir");
- FileStatus[] paths = fs.listStatus(jobOutput);
- Path finalOutputPath =
- getFinalPath(finalOutputDir, jobOutput, origJobOutputPath);
- fs.mkdirs(finalOutputPath);
- LOG.debug("Creating dirs along job output path " + finalOutputPath);
- if (paths != null) {
- for (FileStatus path : paths) {
- moveJobOutputs(fs, origJobOutputPath, finalOutputDir, path.getPath());
- }
- }
- }
+ * Merge two paths together. Anything in from will be moved into to, if there
+ * are any name conflicts while merging the files or directories in from win.
+ * @param fs the File System to use
+ * @param from the path data is coming from.
+ * @param to the path data is going to.
+ * @throws IOException on any error
+ */
+ private static void mergePaths(FileSystem fs, final FileStatus from,
+ final Path to)
+ throws IOException {
+ LOG.debug("Merging data from "+from+" to "+to);
+ if(from.isFile()) {
+ if(fs.exists(to)) {
+ if(!fs.delete(to, true)) {
+ throw new IOException("Failed to delete "+to);
+ }
+ }
+
+ if(!fs.rename(from.getPath(), to)) {
+ throw new IOException("Failed to rename "+from+" to "+to);
+ }
+ } else if(from.isDirectory()) {
+ if(fs.exists(to)) {
+ FileStatus toStat = fs.getFileStatus(to);
+ if(!toStat.isDirectory()) {
+ if(!fs.delete(to, true)) {
+ throw new IOException("Failed to delete "+to);
+ }
+ if(!fs.rename(from.getPath(), to)) {
+ throw new IOException("Failed to rename "+from+" to "+to);
+ }
+ } else {
+ //It is a directory so merge everything in the directories
+ for(FileStatus subFrom: fs.listStatus(from.getPath())) {
+ Path subTo = new Path(to, subFrom.getPath().getName());
+ mergePaths(fs, subFrom, subTo);
+ }
+ }
+ } else {
+ //it does not exist just rename
+ if(!fs.rename(from.getPath(), to)) {
+ throw new IOException("Failed to rename "+from+" to "+to);
+ }
+ }
+ }
}
@Override
@Deprecated
public void cleanupJob(JobContext context) throws IOException {
- if (outputPath != null) {
- Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
- FileSystem fileSys = tmpDir.getFileSystem(context.getConfiguration());
- if (fileSys.exists(tmpDir)) {
- fileSys.delete(tmpDir, true);
- }
+ if (hasOutputPath()) {
+ Path pendingJobAttemptsPath = getPendingJobAttemptsPath();
+ FileSystem fs = pendingJobAttemptsPath
+ .getFileSystem(context.getConfiguration());
+ fs.delete(pendingJobAttemptsPath, true);
} else {
- LOG.warn("Output Path is null in cleanup");
+ LOG.warn("Output Path is null in cleanupJob()");
}
}
@@ -217,69 +402,40 @@ public class FileOutputCommitter extends
* Move the files from the work directory to the job output directory
* @param context the task context
*/
+ @Override
public void commitTask(TaskAttemptContext context)
throws IOException {
- TaskAttemptID attemptId = context.getTaskAttemptID();
- if (workPath != null) {
- context.progress();
- if (outputFileSystem.exists(workPath)) {
- // Move the task outputs to the current job attempt output dir
- Path jobOutputPath =
- new Path(outputPath, getJobAttemptBaseDirName(context));
- moveTaskOutputs(context, outputFileSystem, jobOutputPath, workPath);
- // Delete the temporary task-specific output directory
- if (!outputFileSystem.delete(workPath, true)) {
- LOG.warn("Failed to delete the temporary output" +
- " directory of task: " + attemptId + " - " + workPath);
- }
- LOG.info("Saved output of task '" + attemptId + "' to " +
- jobOutputPath);
- }
- }
+ commitTask(context, null);
}
- /**
- * Move all of the files from the work directory to the final output
- * @param context the task context
- * @param fs the output file system
- * @param jobOutputDir the final output direcotry
- * @param taskOutput the work path
- * @throws IOException
- */
- private void moveTaskOutputs(TaskAttemptContext context,
- FileSystem fs,
- Path jobOutputDir,
- Path taskOutput)
+ @Private
+ public void commitTask(TaskAttemptContext context, Path taskAttemptPath)
throws IOException {
TaskAttemptID attemptId = context.getTaskAttemptID();
- context.progress();
- LOG.debug("Told to move taskoutput from " + taskOutput
- + " to " + jobOutputDir);
- if (fs.isFile(taskOutput)) {
- Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput,
- workPath);
- if (!fs.rename(taskOutput, finalOutputPath)) {
- if (!fs.delete(finalOutputPath, true)) {
- throw new IOException("Failed to delete earlier output of task: " +
- attemptId);
- }
- if (!fs.rename(taskOutput, finalOutputPath)) {
- throw new IOException("Failed to save output of task: " +
- attemptId);
- }
+ if (hasOutputPath()) {
+ context.progress();
+ if(taskAttemptPath == null) {
+ taskAttemptPath = getTaskAttemptPath(context);
}
- LOG.debug("Moved " + taskOutput + " to " + finalOutputPath);
- } else if(fs.getFileStatus(taskOutput).isDirectory()) {
- LOG.debug("Taskoutput " + taskOutput + " is a dir");
- FileStatus[] paths = fs.listStatus(taskOutput);
- Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput, workPath);
- fs.mkdirs(finalOutputPath);
- LOG.debug("Creating dirs along path " + finalOutputPath);
- if (paths != null) {
- for (FileStatus path : paths) {
- moveTaskOutputs(context, fs, jobOutputDir, path.getPath());
+ Path committedTaskPath = getCommittedTaskPath(context);
+ FileSystem fs = taskAttemptPath.getFileSystem(context.getConfiguration());
+ if (fs.exists(taskAttemptPath)) {
+ if(fs.exists(committedTaskPath)) {
+ if(!fs.delete(committedTaskPath, true)) {
+ throw new IOException("Could not delete " + committedTaskPath);
+ }
+ }
+ if(!fs.rename(taskAttemptPath, committedTaskPath)) {
+ throw new IOException("Could not rename " + taskAttemptPath + " to "
+ + committedTaskPath);
}
+ LOG.info("Saved output of task '" + attemptId + "' to " +
+ committedTaskPath);
+ } else {
+ LOG.warn("No Output found for " + attemptId);
}
+ } else {
+ LOG.warn("Output Path is null in commitTask()");
}
}
@@ -289,38 +445,22 @@ public class FileOutputCommitter extends
*/
@Override
public void abortTask(TaskAttemptContext context) throws IOException {
- if (workPath != null) {
- context.progress();
- outputFileSystem.delete(workPath, true);
- }
+ abortTask(context, null);
}
- /**
- * Find the final name of a given output file, given the job output directory
- * and the work directory.
- * @param jobOutputDir the job's output directory
- * @param taskOutput the specific task output file
- * @param taskOutputPath the job's work directory
- * @return the final path for the specific output file
- * @throws IOException
- */
- private Path getFinalPath(Path jobOutputDir, Path taskOutput,
- Path taskOutputPath) throws IOException {
- URI taskOutputUri = taskOutput.makeQualified(outputFileSystem.getUri(),
- outputFileSystem.getWorkingDirectory()).toUri();
- URI taskOutputPathUri =
- taskOutputPath.makeQualified(
- outputFileSystem.getUri(),
- outputFileSystem.getWorkingDirectory()).toUri();
- URI relativePath = taskOutputPathUri.relativize(taskOutputUri);
- if (taskOutputUri == relativePath) {
- throw new IOException("Can not get the relative path: base = " +
- taskOutputPathUri + " child = " + taskOutputUri);
- }
- if (relativePath.getPath().length() > 0) {
- return new Path(jobOutputDir, relativePath.getPath());
+ @Private
+ public void abortTask(TaskAttemptContext context, Path taskAttemptPath) throws IOException {
+ if (hasOutputPath()) {
+ context.progress();
+ if(taskAttemptPath == null) {
+ taskAttemptPath = getTaskAttemptPath(context);
+ }
+ FileSystem fs = taskAttemptPath.getFileSystem(context.getConfiguration());
+ if(!fs.delete(taskAttemptPath, true)) {
+ LOG.warn("Could not delete "+taskAttemptPath);
+ }
} else {
- return jobOutputDir;
+ LOG.warn("Output Path is null in abortTask()");
}
}
@@ -331,16 +471,20 @@ public class FileOutputCommitter extends
@Override
public boolean needsTaskCommit(TaskAttemptContext context
) throws IOException {
- return workPath != null && outputFileSystem.exists(workPath);
+ return needsTaskCommit(context, null);
}
- /**
- * Get the directory that the task should write results into
- * @return the work directory
- * @throws IOException
- */
- public Path getWorkPath() throws IOException {
- return workPath;
+ @Private
+ public boolean needsTaskCommit(TaskAttemptContext context, Path taskAttemptPath
+ ) throws IOException {
+ if(hasOutputPath()) {
+ if(taskAttemptPath == null) {
+ taskAttemptPath = getTaskAttemptPath(context);
+ }
+ FileSystem fs = taskAttemptPath.getFileSystem(context.getConfiguration());
+ return fs.exists(taskAttemptPath);
+ }
+ return false;
}
@Override
@@ -352,43 +496,35 @@ public class FileOutputCommitter extends
public void recoverTask(TaskAttemptContext context)
throws IOException {
context.progress();
- Path jobOutputPath =
- new Path(outputPath, getJobAttemptBaseDirName(context));
- int previousAttempt =
- context.getConfiguration().getInt(
- MRJobConfig.APPLICATION_ATTEMPT_ID, 0) - 1;
+ TaskAttemptID attemptId = context.getTaskAttemptID();
+ int previousAttempt = getAppAttemptId(context) - 1;
if (previousAttempt < 0) {
throw new IOException ("Cannot recover task output for first attempt...");
}
-
- Path pathToRecover =
- new Path(outputPath, getJobAttemptBaseDirName(previousAttempt));
- LOG.debug("Trying to recover task from " + pathToRecover
- + " into " + jobOutputPath);
- if (outputFileSystem.exists(pathToRecover)) {
- // Move the task outputs to their final place
- moveJobOutputs(outputFileSystem,
- pathToRecover, jobOutputPath, pathToRecover);
- LOG.info("Saved output of job to " + jobOutputPath);
+
+ Path committedTaskPath = getCommittedTaskPath(context);
+ Path previousCommittedTaskPath = getCommittedTaskPath(
+ previousAttempt, context);
+ FileSystem fs = committedTaskPath.getFileSystem(context.getConfiguration());
+
+ LOG.debug("Trying to recover task from " + previousCommittedTaskPath
+ + " into " + committedTaskPath);
+ if (fs.exists(previousCommittedTaskPath)) {
+ if(fs.exists(committedTaskPath)) {
+ if(!fs.delete(committedTaskPath, true)) {
+ throw new IOException("Could not delete "+committedTaskPath);
+ }
+ }
+ //Rename can fail if the parent directory does not yet exist.
+ Path committedParent = committedTaskPath.getParent();
+ fs.mkdirs(committedParent);
+ if(!fs.rename(previousCommittedTaskPath, committedTaskPath)) {
+ throw new IOException("Could not rename " + previousCommittedTaskPath +
+ " to " + committedTaskPath);
+ }
+ LOG.info("Saved output of " + attemptId + " to " + committedTaskPath);
+ } else {
+ LOG.warn(attemptId+" had no output to recover.");
}
}
-
- protected static String getJobAttemptBaseDirName(JobContext context) {
- int appAttemptId =
- context.getConfiguration().getInt(
- MRJobConfig.APPLICATION_ATTEMPT_ID, 0);
- return getJobAttemptBaseDirName(appAttemptId);
- }
-
- protected static String getJobAttemptBaseDirName(int appAttemptId) {
- return FileOutputCommitter.TEMP_DIR_NAME + Path.SEPARATOR +
- + appAttemptId;
- }
-
- protected static String getTaskAttemptBaseDirName(
- TaskAttemptContext context) {
- return getJobAttemptBaseDirName(context) + Path.SEPARATOR +
- FileOutputCommitter.TEMP_DIR_NAME + Path.SEPARATOR +
- "_" + context.getTaskAttemptID().toString();
- }
}
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java Sat Feb 4 03:40:45 2012
@@ -79,7 +79,17 @@ public class TokenCache {
}
obtainTokensForNamenodesInternal(credentials, ps, conf);
}
-
+
+ /**
+ * Remove jobtoken referrals which don't make sense in the context
+ * of the task execution.
+ *
+ * @param conf
+ */
+ public static void cleanUpTokenReferral(Configuration conf) {
+ conf.unset(MRJobConfig.MAPREDUCE_JOB_CREDENTIALS_BINARY);
+ }
+
static void obtainTokensForNamenodesInternal(Credentials credentials,
Path[] ps, Configuration conf) throws IOException {
for(Path p: ps) {
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java Sat Feb 4 03:40:45 2012
@@ -338,7 +338,7 @@ public class CLI extends Configured impl
LogParams logParams = cluster.getLogParams(jobID, taskAttemptID);
LogDumper logDumper = new LogDumper();
logDumper.setConf(getConf());
- logDumper.dumpAContainersLogs(logParams.getApplicationId(),
+ exitCode = logDumper.dumpAContainersLogs(logParams.getApplicationId(),
logParams.getContainerId(), logParams.getNodeId(),
logParams.getOwner());
} catch (IOException e) {
Propchange: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Feb 4 03:40:45 2012
@@ -1,4 +1,4 @@
-/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml:1227776-1239397
-/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml:1164771,1167318,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1214066,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1237549
+/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml:1227776-1240449
+/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml:1164771,1167318,1167383,1170379,1170459,1171297,1172916,1173402,1176550,1177487,1177531,1177859,1177864,1182189,1182205,1182214,1189932,1189982,1195575,1196113,1196129,1204114,1204117,1204122,1204124,1204129,1204131,1204177,1204370,1204376,1204388,1205260,1205697,1206786,1206830,1207694,1208153,1208313,1212021,1212062,1212073,1212084,1213537,1213586,1213592-1213593,1213954,1214046,1214066,1220510,1221348,1225114,1225192,1225456,1225489,1225591,1226211,1226239,1226350,1227091,1227165,1227423,1227964,1229347,1230398,1231569,1231572,1231627,1231640,1233605,1234555,1235135,1235137,1235956,1236456,1237549,1239752
/hadoop/core/branches/branch-0.19/mapred/src/java/mapred-default.xml:713112
/hadoop/core/trunk/src/mapred/mapred-default.xml:776175-785643
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestFileOutputCommitter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestFileOutputCommitter.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestFileOutputCommitter.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestFileOutputCommitter.java Sat Feb 4 03:40:45 2012
@@ -105,10 +105,9 @@ public class TestFileOutputCommitter ext
// do commit
committer.commitTask(tContext);
- Path jobTempDir1 = new Path(outDir,
- FileOutputCommitter.getJobAttemptBaseDirName(
- conf.getInt(MRConstants.APPLICATION_ATTEMPT_ID, 0)));
- assertTrue((new File(jobTempDir1.toString()).exists()));
+ Path jobTempDir1 = committer.getCommittedTaskPath(tContext);
+ File jtd1 = new File(jobTempDir1.toUri().getPath());
+ assertTrue(jtd1.exists());
validateContent(jobTempDir1);
//now while running the second app attempt,
@@ -119,14 +118,12 @@ public class TestFileOutputCommitter ext
JobContext jContext2 = new JobContextImpl(conf2, taskID.getJobID());
TaskAttemptContext tContext2 = new TaskAttemptContextImpl(conf2, taskID);
FileOutputCommitter committer2 = new FileOutputCommitter();
- committer.setupJob(jContext2);
- Path jobTempDir2 = new Path(outDir,
- FileOutputCommitter.getJobAttemptBaseDirName(
- conf2.getInt(MRConstants.APPLICATION_ATTEMPT_ID, 0)));
- assertTrue((new File(jobTempDir2.toString()).exists()));
+ committer2.setupJob(jContext2);
+ Path jobTempDir2 = committer2.getCommittedTaskPath(tContext2);
- tContext2.getConfiguration().setInt(MRConstants.APPLICATION_ATTEMPT_ID, 2);
committer2.recoverTask(tContext2);
+ File jtd2 = new File(jobTempDir2.toUri().getPath());
+ assertTrue(jtd2.exists());
validateContent(jobTempDir2);
committer2.commitJob(jContext2);
@@ -135,7 +132,8 @@ public class TestFileOutputCommitter ext
}
private void validateContent(Path dir) throws IOException {
- File expectedFile = new File(new Path(dir, partFile).toString());
+ File fdir = new File(dir.toUri().getPath());
+ File expectedFile = new File(fdir, partFile);
StringBuffer expectedOutput = new StringBuffer();
expectedOutput.append(key1).append('\t').append(val1).append("\n");
expectedOutput.append(val1).append("\n");
@@ -244,21 +242,17 @@ public class TestFileOutputCommitter ext
// do abort
committer.abortTask(tContext);
- FileSystem outputFileSystem = outDir.getFileSystem(conf);
- Path workPath = new Path(outDir,
- committer.getTaskAttemptBaseDirName(tContext))
- .makeQualified(outputFileSystem);
- File expectedFile = new File(new Path(workPath, partFile)
- .toString());
+ File out = new File(outDir.toUri().getPath());
+ Path workPath = committer.getWorkPath(tContext, outDir);
+ File wp = new File(workPath.toUri().getPath());
+ File expectedFile = new File(wp, partFile);
assertFalse("task temp dir still exists", expectedFile.exists());
committer.abortJob(jContext, JobStatus.State.FAILED);
- expectedFile = new File(new Path(outDir, FileOutputCommitter.TEMP_DIR_NAME)
- .toString());
+ expectedFile = new File(out, FileOutputCommitter.TEMP_DIR_NAME);
assertFalse("job temp dir still exists", expectedFile.exists());
- assertEquals("Output directory not empty", 0, new File(outDir.toString())
- .listFiles().length);
- FileUtil.fullyDelete(new File(outDir.toString()));
+ assertEquals("Output directory not empty", 0, out.listFiles().length);
+ FileUtil.fullyDelete(out);
}
public static class FakeFileSystem extends RawLocalFileSystem {
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/TestFileOutputCommitter.java Sat Feb 4 03:40:45 2012
@@ -60,6 +60,22 @@ public class TestFileOutputCommitter ext
private Text val2 = new Text("val2");
+ private static void cleanup() throws IOException {
+ Configuration conf = new Configuration();
+ FileSystem fs = outDir.getFileSystem(conf);
+ fs.delete(outDir, true);
+ }
+
+ @Override
+ public void setUp() throws IOException {
+ cleanup();
+ }
+
+ @Override
+ public void tearDown() throws IOException {
+ cleanup();
+ }
+
private void writeOutput(RecordWriter theRecordWriter,
TaskAttemptContext context) throws IOException, InterruptedException {
NullWritable nullWritable = NullWritable.get();
@@ -114,11 +130,10 @@ public class TestFileOutputCommitter ext
// do commit
committer.commitTask(tContext);
- Path jobTempDir1 = new Path(outDir,
- FileOutputCommitter.getJobAttemptBaseDirName(
- conf.getInt(MRJobConfig.APPLICATION_ATTEMPT_ID, 0)));
- assertTrue((new File(jobTempDir1.toString()).exists()));
- validateContent(jobTempDir1);
+ Path jobTempDir1 = committer.getCommittedTaskPath(tContext);
+ File jtd = new File(jobTempDir1.toUri().getPath());
+ assertTrue(jtd.exists());
+ validateContent(jtd);
//now while running the second app attempt,
//recover the task output from first attempt
@@ -128,15 +143,13 @@ public class TestFileOutputCommitter ext
JobContext jContext2 = new JobContextImpl(conf2, taskID.getJobID());
TaskAttemptContext tContext2 = new TaskAttemptContextImpl(conf2, taskID);
FileOutputCommitter committer2 = new FileOutputCommitter(outDir, tContext2);
- committer.setupJob(tContext2);
- Path jobTempDir2 = new Path(outDir,
- FileOutputCommitter.getJobAttemptBaseDirName(
- conf2.getInt(MRJobConfig.APPLICATION_ATTEMPT_ID, 0)));
- assertTrue((new File(jobTempDir2.toString()).exists()));
+ committer2.setupJob(tContext2);
+ Path jobTempDir2 = committer2.getCommittedTaskPath(tContext2);
+ File jtd2 = new File(jobTempDir2.toUri().getPath());
- tContext2.getConfiguration().setInt(MRJobConfig.APPLICATION_ATTEMPT_ID, 2);
committer2.recoverTask(tContext2);
- validateContent(jobTempDir2);
+ assertTrue(jtd2.exists());
+ validateContent(jtd2);
committer2.commitJob(jContext2);
validateContent(outDir);
@@ -144,7 +157,12 @@ public class TestFileOutputCommitter ext
}
private void validateContent(Path dir) throws IOException {
- File expectedFile = new File(new Path(dir, partFile).toString());
+ validateContent(new File(dir.toUri().getPath()));
+ }
+
+ private void validateContent(File dir) throws IOException {
+ File expectedFile = new File(dir, partFile);
+ assertTrue("Could not find "+expectedFile, expectedFile.exists());
StringBuffer expectedOutput = new StringBuffer();
expectedOutput.append(key1).append('\t').append(val1).append("\n");
expectedOutput.append(val1).append("\n");
@@ -259,7 +277,7 @@ public class TestFileOutputCommitter ext
assertFalse("task temp dir still exists", expectedFile.exists());
committer.abortJob(jContext, JobStatus.State.FAILED);
- expectedFile = new File(new Path(outDir, FileOutputCommitter.TEMP_DIR_NAME)
+ expectedFile = new File(new Path(outDir, FileOutputCommitter.PENDING_DIR_NAME)
.toString());
assertFalse("job temp dir still exists", expectedFile.exists());
assertEquals("Output directory not empty", 0, new File(outDir.toString())
@@ -315,12 +333,10 @@ public class TestFileOutputCommitter ext
assertNotNull(th);
assertTrue(th instanceof IOException);
assertTrue(th.getMessage().contains("fake delete failed"));
- File jobTmpDir = new File(new Path(outDir,
- FileOutputCommitter.TEMP_DIR_NAME + Path.SEPARATOR +
- conf.getInt(MRJobConfig.APPLICATION_ATTEMPT_ID, 0) +
- Path.SEPARATOR +
- FileOutputCommitter.TEMP_DIR_NAME).toString());
- File taskTmpDir = new File(jobTmpDir, "_" + taskID);
+ Path jtd = committer.getJobAttemptPath(jContext);
+ File jobTmpDir = new File(jtd.toUri().getPath());
+ Path ttd = committer.getTaskAttemptPath(tContext);
+ File taskTmpDir = new File(ttd.toUri().getPath());
File expectedFile = new File(taskTmpDir, partFile);
assertTrue(expectedFile + " does not exists", expectedFile.exists());
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java Sat Feb 4 03:40:45 2012
@@ -19,6 +19,8 @@
package org.apache.hadoop.mapreduce.security;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -33,6 +35,7 @@ import org.apache.hadoop.conf.Configurat
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.Master;
+import org.apache.hadoop.mapreduce.MRJobConfig;
import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -158,4 +161,13 @@ public class TestTokenCache {
return mockFs;
}
+
+ @Test
+ public void testCleanUpTokenReferral() throws Exception {
+ Configuration conf = new Configuration();
+ conf.set(MRJobConfig.MAPREDUCE_JOB_CREDENTIALS_BINARY, "foo");
+ TokenCache.cleanUpTokenReferral(conf);
+ assertNull(conf.get(MRJobConfig.MAPREDUCE_JOB_CREDENTIALS_BINARY));
+ }
+
}
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java Sat Feb 4 03:40:45 2012
@@ -249,8 +249,9 @@ public class CompletedJob implements org
}
if (historyFileAbsolute != null) {
+ JobHistoryParser parser = null;
try {
- JobHistoryParser parser =
+ parser =
new JobHistoryParser(historyFileAbsolute.getFileSystem(conf),
historyFileAbsolute);
jobInfo = parser.parse();
@@ -258,6 +259,12 @@ public class CompletedJob implements org
throw new YarnException("Could not load history file "
+ historyFileAbsolute, e);
}
+ IOException parseException = parser.getParseException();
+ if (parseException != null) {
+ throw new YarnException(
+ "Could not parse history file " + historyFileAbsolute,
+ parseException);
+ }
} else {
throw new IOException("History file not found");
}
@@ -321,9 +328,6 @@ public class CompletedJob implements org
@Override
public
boolean checkAccess(UserGroupInformation callerUGI, JobACL jobOperation) {
- if (!UserGroupInformation.isSecurityEnabled()) {
- return true;
- }
Map<JobACL, AccessControlList> jobACLs = jobInfo.getJobACLs();
AccessControlList jobACL = jobACLs.get(jobOperation);
return aclsMgr.checkAccess(callerUGI, jobOperation,
Modified: hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java?rev=1240450&r1=1240449&r2=1240450&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java (original)
+++ hadoop/common/branches/branch-0.23-PB/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java Sat Feb 4 03:40:45 2012
@@ -152,7 +152,7 @@ public class PartialJob implements org.a
@Override
public boolean checkAccess(UserGroupInformation callerUGI, JobACL jobOperation) {
- return false;
+ return true;
}
@Override