Ver código fonte

HADOOP-2869. Deprecate SequenceFile.setCompressionType in favor of
SequenceFile.createWriter, SequenceFileOutputFormat.setCompressionType,
and JobConf.setMapOutputCompressionType. Contributed by Arun C Murthy
Configuration changes to hadoop-default.xml:
deprecated io.seqfile.compression.type




git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.16@634432 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 anos atrás
pai
commit
25b2188ad1

+ 6 - 0
CHANGES.txt

@@ -7,6 +7,12 @@ Release 0.16.1 - Unreleased
     HADOOP-2861. Improve the user interface for the HOD commands. 
     Command line structure has changed. (Hemanth Yamijala via nigel)
 
+    HADOOP-2869. Deprecate SequenceFile.setCompressionType in favor of
+    SequenceFile.createWriter, SequenceFileOutputFormat.setCompressionType,
+    and JobConf.setMapOutputCompressionType. (Arun C Murthy via cdouglas)
+    Configuration changes to hadoop-default.xml:
+      deprecated io.seqfile.compression.type
+
   IMPROVEMENTS
 
     HADOOP-2371. User guide for file permissions in HDFS.

+ 0 - 7
conf/hadoop-default.xml

@@ -857,13 +857,6 @@ creations/deletions), or "all".</description>
   </description>
 </property>
 
-<property>
-  <name>io.seqfile.compression.type</name>
-  <value>RECORD</value>
-  <description>The default compression type for SequenceFile.Writer.
-  </description>
-</property>
-
 <property>
   <name>map.sort.class</name>
   <value>org.apache.hadoop.mapred.MergeSorter</value>

+ 2 - 2
src/contrib/data_join/src/java/org/apache/hadoop/contrib/utils/join/DataJoinJob.java

@@ -102,8 +102,8 @@ public class DataJoinJob {
     job.setMapperClass(mapper);
     job.setOutputPath(new Path(outputDir));
     job.setOutputFormat(outputFormat);
-    SequenceFile.setCompressionType(job,
-                                    SequenceFile.CompressionType.BLOCK);
+    SequenceFileOutputFormat.setOutputCompressionType(job,
+            SequenceFile.CompressionType.BLOCK);
     job.setMapOutputKeyClass(Text.class);
     job.setMapOutputValueClass(mapoutputValueClass);
     job.setOutputKeyClass(Text.class);

+ 13 - 0
src/java/org/apache/hadoop/io/SequenceFile.java

@@ -217,7 +217,12 @@ public class SequenceFile {
    * Get the compression type for the reduce outputs
    * @param job the job config to look in
    * @return the kind of compression to use
+   * @deprecated Use {@link org.apache.hadoop.mapred.JobConf#getMapOutputCompressionType()}
+   *             to get {@link CompressionType} for intermediate map-outputs or
+   *             {@link org.apache.hadoop.mapred.SequenceFileOutputFormat#getOutputCompressionType(org.apache.hadoop.mapred.JobConf)} 
+   *             to get {@link CompressionType} for job-outputs.
    */
+  @Deprecated
   static public CompressionType getCompressionType(Configuration job) {
     String name = job.get("io.seqfile.compression.type");
     return name == null ? CompressionType.RECORD : 
@@ -228,7 +233,15 @@ public class SequenceFile {
    * Set the compression type for sequence files.
    * @param job the configuration to modify
    * @param val the new compression type (none, block, record)
+   * @deprecated Use the one of the many SequenceFile.createWriter methods to specify
+   *             the {@link CompressionType} while creating the {@link SequenceFile} or
+   *             {@link org.apache.hadoop.mapred.JobConf#setMapOutputCompressionType(org.apache.hadoop.io.SequenceFile.CompressionType)}
+   *             to specify the {@link CompressionType} for intermediate map-outputs or 
+   *             {@link org.apache.hadoop.mapred.SequenceFileOutputFormat#setOutputCompressionType(org.apache.hadoop.mapred.JobConf, org.apache.hadoop.io.SequenceFile.CompressionType)}
+   *             to specify the {@link CompressionType} for job-outputs. 
+   * or 
    */
+  @Deprecated
   static public void setCompressionType(Configuration job, 
                                         CompressionType val) {
     job.set("io.seqfile.compression.type", val.toString());

+ 2 - 0
src/java/org/apache/hadoop/mapred/JobConf.java

@@ -505,6 +505,7 @@ public class JobConf extends Configuration {
    *              are compressed.
    */
   public void setMapOutputCompressionType(CompressionType style) {
+    setCompressMapOutput(true);
     set("mapred.map.output.compression.type", style.toString());
   }
   
@@ -528,6 +529,7 @@ public class JobConf extends Configuration {
    */
   public void 
   setMapOutputCompressorClass(Class<? extends CompressionCodec> codecClass) {
+    setCompressMapOutput(true);
     setClass("mapred.map.output.compression.codec", codecClass, 
              CompressionCodec.class);
   }

+ 1 - 0
src/java/org/apache/hadoop/mapred/SequenceFileOutputFormat.java

@@ -113,6 +113,7 @@ public class SequenceFileOutputFormat extends OutputFormatBase {
    */
   public static void setOutputCompressionType(JobConf conf, 
 		                                          CompressionType style) {
+    setCompressOutput(conf, true);
     conf.set("mapred.output.compression.type", style.toString());
   }
 

+ 0 - 1
src/test/org/apache/hadoop/io/FileBench.java

@@ -268,7 +268,6 @@ public class FileBench extends Configured implements Tool {
     public void configure(JobConf job) {
       job.set("mapred.map.output.compression.type", typ);
       job.set("mapred.output.compression.type", typ);
-      job.set("io.seqfile.compression.type", typ);
     }
   }
   enum Format {