MAPREDUCE-5808. Port output replication factor configurable for terasort to Hadoop 1.x. Contributed by Chuan Liu.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1-win@1580988 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.branch-1-win.txt b/CHANGES.branch-1-win.txt
index b40d4ed..410e5ae 100644
--- a/CHANGES.branch-1-win.txt
+++ b/CHANGES.branch-1-win.txt
@@ -513,3 +513,6 @@
HDFS-5516. WebHDFS does not require user name when anonymous http requests
are disallowed. (Miodrag Radulovic via cnauroth)
+
+ MAPREDUCE-5808. Port output replication factor configurable for terasort to
+ Hadoop 1.x. (Chuan Liu via cnauroth)
diff --git a/src/examples/org/apache/hadoop/examples/terasort/TeraSort.java b/src/examples/org/apache/hadoop/examples/terasort/TeraSort.java
index d119c01..4e32eac 100644
--- a/src/examples/org/apache/hadoop/examples/terasort/TeraSort.java
+++ b/src/examples/org/apache/hadoop/examples/terasort/TeraSort.java
@@ -49,6 +49,7 @@
*/
public class TeraSort extends Configured implements Tool {
private static final Log LOG = LogFactory.getLog(TeraSort.class);
+ private static final String OUTPUT_REPLICATION = "mapreduce.terasort.output.replication";
/**
* A partitioner that splits text keys into roughly equal partitions
@@ -222,6 +223,10 @@
}
}
+
+ public static int getOutputReplication(JobConf job) {
+ return job.getInt(OUTPUT_REPLICATION, 1);
+ }
public int run(String[] args) throws Exception {
LOG.info("starting");
@@ -243,7 +248,7 @@
TeraInputFormat.writePartitionFile(job, partitionFile);
DistributedCache.addCacheFile(partitionUri, job);
DistributedCache.createSymlink(job);
- job.setInt("dfs.replication", 1);
+ job.setInt("dfs.replication", getOutputReplication(job));
TeraOutputFormat.setFinalSync(job, true);
JobClient.runJob(job);
LOG.info("done");