hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amareshw...@apache.org
Subject svn commit: r955198 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
Date Wed, 16 Jun 2010 11:20:58 GMT
Author: amareshwari
Date: Wed Jun 16 11:20:58 2010
New Revision: 955198

URL: http://svn.apache.org/viewvc?rev=955198&view=rev
Log:
MAPREDUCE-1853. Adds caching for TaskAttemptContext in MultipleOutputs. Contributed by Torsten
Curdt.

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

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=955198&r1=955197&r2=955198&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Wed Jun 16 11:20:58 2010
@@ -783,6 +783,9 @@ Release 0.21.0 - Unreleased
     MAPREDUCE-1610. Forrest documentation should be updated to reflect
     the changes in MAPREDUCE-856. (Ravi Gummadi via vinodkv)
 
+    MAPREDUCE-1853. Adds caching for TaskAttemptContext in MultipleOutputs.
+    (Torsten Curdt via amareshwari)
+
   BUG FIXES
 
     MAPREDUCE-878. Rename fair scheduler design doc to 

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java?rev=955198&r1=955197&r2=955198&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
(original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java
Wed Jun 16 11:20:58 2010
@@ -131,6 +131,11 @@ public class MultipleOutputs<KEYOUT, VAL
   private static final String COUNTERS_GROUP = MultipleOutputs.class.getName();
 
   /**
+   * Cache for the taskContexts
+   */
+  private Map<String, TaskAttemptContext> taskContexts = new HashMap<String, TaskAttemptContext>();
+
+  /**
    * Checks if a named output name is valid token.
    *
    * @param namedOutput named output Name
@@ -422,15 +427,25 @@ public class MultipleOutputs<KEYOUT, VAL
    // Create a taskAttemptContext for the named output with 
    // output format and output key/value types put in the context
   private TaskAttemptContext getContext(String nameOutput) throws IOException {
+      
+    TaskAttemptContext taskContext = taskContexts.get(nameOutput);
+    
+    if (taskContext != null) {
+        return taskContext;
+    }
+    
     // The following trick leverages the instantiation of a record writer via
     // the job thus supporting arbitrary output formats.
     Job job = new Job(context.getConfiguration());
     job.setOutputFormatClass(getNamedOutputFormatClass(context, nameOutput));
     job.setOutputKeyClass(getNamedOutputKeyClass(context, nameOutput));
     job.setOutputValueClass(getNamedOutputValueClass(context, nameOutput));
-    TaskAttemptContext taskContext = 
+    taskContext = 
       new TaskAttemptContextImpl(job.getConfiguration(), 
                                  context.getTaskAttemptID());
+
+    taskContexts.put(nameOutput, taskContext);
+
     return taskContext;
   }
   



Mime
View raw message