hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1152875 - in /hadoop/common/trunk/mapreduce: CHANGES.txt src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
Date Mon, 01 Aug 2011 17:52:50 GMT
Author: todd
Date: Mon Aug  1 17:52:49 2011
New Revision: 1152875

URL: http://svn.apache.org/viewvc?rev=1152875&view=rev
Log:
MAPREDUCE-2740. MultipleOutputs in new API creates needless TaskAttemptContexts. Contributed
by Todd Lipcon.

Modified:
    hadoop/common/trunk/mapreduce/CHANGES.txt
    hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java

Modified: hadoop/common/trunk/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/mapreduce/CHANGES.txt?rev=1152875&r1=1152874&r2=1152875&view=diff
==============================================================================
--- hadoop/common/trunk/mapreduce/CHANGES.txt (original)
+++ hadoop/common/trunk/mapreduce/CHANGES.txt Mon Aug  1 17:52:49 2011
@@ -212,6 +212,9 @@ Trunk (unreleased changes)
     JobInProgress.getCounters() aquire locks in a shorter time period.
     (Joydeep Sen Sarma via schen)
 
+    MAPREDUCE-2740. MultipleOutputs in new API creates needless
+    TaskAttemptContexts. (todd)
+
   BUG FIXES
 
     MAPREDUCE-2603. Disable High-Ram emulation in system tests. 

Modified: hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java?rev=1152875&r1=1152874&r2=1152875&view=diff
==============================================================================
--- hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
(original)
+++ hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
Mon Aug  1 17:52:49 2011
@@ -132,6 +132,10 @@ public class MultipleOutputs<KEYOUT, VAL
    * Cache for the taskContexts
    */
   private Map<String, TaskAttemptContext> taskContexts = new HashMap<String, TaskAttemptContext>();
+  /**
+   * Cached TaskAttemptContext which uses the job's configured settings
+   */
+  private TaskAttemptContext jobOutputFormatContext;
 
   /**
    * Checks if a named output name is valid token.
@@ -382,11 +386,13 @@ public class MultipleOutputs<KEYOUT, VAL
   public void write(KEYOUT key, VALUEOUT value, String baseOutputPath) 
       throws IOException, InterruptedException {
     checkBaseOutputPath(baseOutputPath);
-    TaskAttemptContext taskContext = 
-      new TaskAttemptContextImpl(context.getConfiguration(), 
-                                 context.getTaskAttemptID(),
-                                 new WrappedStatusReporter(context));
-    getRecordWriter(taskContext, baseOutputPath).write(key, value);
+    if (jobOutputFormatContext == null) {
+      jobOutputFormatContext = 
+        new TaskAttemptContextImpl(context.getConfiguration(), 
+                                   context.getTaskAttemptID(),
+                                   new WrappedStatusReporter(context));
+    }
+    getRecordWriter(jobOutputFormatContext, baseOutputPath).write(key, value);
   }
 
   // by being synchronized MultipleOutputTask can be use with a



Mime
View raw message