Author: gates
Date: Fri Apr 11 06:44:01 2008
New Revision: 647166

URL: http://svn.apache.org/viewvc?rev=647166&view=rev
Log:
PIG-179 Fix occasional crash in Hadoop 0.16 caused by input reader being thread 
local.


Modified:
    incubator/pig/trunk/CHANGES.txt
    
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigInputFormat.java

Modified: incubator/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=647166&r1=647165&r2=647166&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Fri Apr 11 06:44:01 2008
@@ -197,6 +197,9 @@
        the top level directory (joa23 via gates).
 
     PIG-94: M3 code update for streaming (arunc via olgan)
+
+       PIG-179: Changed PigRecordReader to be a static singleton rather than
+       thread local.  (gates).
     
     PIG-55: added custom splitter (groves via olgan)
 

Modified: 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigInputFormat.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigInputFormat.java?rev=647166&r1=647165&r2=647166&view=diff
==============================================================================
--- 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigInputFormat.java
 (original)
+++ 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigInputFormat.java
 Fri Apr 11 06:44:01 2008
@@ -110,7 +110,7 @@
 
     public RecordReader<Text, Tuple> getRecordReader(InputSplit split,
             JobConf job, Reporter reporter) throws IOException {
-        activeSplit.set((SliceWrapper) split);
+        activeSplit = (SliceWrapper) split;
         return ((SliceWrapper) split).makeReader(job);
     }
 
@@ -118,16 +118,10 @@
     }
 
     public static SliceWrapper getActiveSplit() {
-        return activeSplit.get();
+        return activeSplit;
     }
 
-    /**
-     * This is a tremendously ugly hack to get around the fact that mappers do
-     * not have access to their readers. We take advantage of the fact that
-     * RecordReader.next and Mapper.map is run on same the thread to share
-     * information through a thread local variable.
-     */
-    private static ThreadLocal<SliceWrapper> activeSplit = new 
ThreadLocal<SliceWrapper>();
+    private static SliceWrapper activeSplit;
 
     public void validateInput(JobConf arg0) throws IOException {
     }


Reply via email to