Browse Source

HADOOP-758. Fix exception handling during reduce so that root exceptions are not masked by exceptions in cleanups. Contributed by Raghu.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@499998 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
807756bcc4
2 changed files with 18 additions and 2 deletions
  1. 4 0
      CHANGES.txt
  2. 14 2
      src/java/org/apache/hadoop/mapred/ReduceTask.java

+ 4 - 0
CHANGES.txt

@@ -111,6 +111,10 @@ Release 0.10.1 - 2007-01-10
     currently usable.  Locking should eventually provided as an
     independent service.  (Raghu Angadi via cutting)
 
+16. HADOOP-758.  Fix exception handling during reduce so that root
+    exceptions are not masked by exceptions in cleanups.
+    (Raghu Angadi via cutting)
+
 
 Release 0.10.0 - 2007-01-05
 

+ 14 - 2
src/java/org/apache/hadoop/mapred/ReduceTask.java

@@ -326,12 +326,24 @@ class ReduceTask extends Task {
         values.informReduceProgress();
       }
 
-    } finally {
+      //Clean up: repeated in catch block below
       reducer.close();
       out.close(reporter);
+      //End of clean up.
+      
       if( runSpeculative ){
         ((PhasedFileSystem)fs).commit(); 
-       }
+      }
+    } catch ( IOException ioe ) {
+      try {
+        reducer.close();
+      } catch ( IOException ignored ) {}
+        
+      try {
+        out.close(reporter);
+      } catch ( IOException ignored ) {}
+      
+      throw ioe;
     }
     done(umbilical);
   }