Quellcode durchsuchen

MAPREDUCE-2846. Fixed a race condition in writing the log index file that
caused tasks to fail. (omalley)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-204@1159730 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley vor 13 Jahren
Ursprung
Commit
4928f5e794
2 geänderte Dateien mit 8 neuen und 3 gelöschten Zeilen
  1. 3 0
      CHANGES.txt
  2. 5 3
      src/mapred/org/apache/hadoop/mapred/TaskLog.java

+ 3 - 0
CHANGES.txt

@@ -13,6 +13,9 @@ Release 0.20.204.0 - 2011-8-19
 
   BUG FIXES
 
+    MAPREDUCE-2846. Fixed a race condition in writing the log index file that
+    caused tasks to fail. (omalley)
+
     MAPREDUCE-2651. Fix race condition in Linux task controller for
     job log directory creation. (Bharath Mundlapudi via llu)
 

+ 5 - 3
src/mapred/org/apache/hadoop/mapred/TaskLog.java

@@ -308,9 +308,11 @@ public class TaskLog {
     }
   }
   
-  static void writeToIndexFile(String logLocation,
-      TaskAttemptID currentTaskid, boolean isCleanup,
-      Map<LogName, Long[]> lengths) throws IOException {
+  static synchronized 
+  void writeToIndexFile(String logLocation,
+                        TaskAttemptID currentTaskid, 
+                        boolean isCleanup,
+                        Map<LogName, Long[]> lengths) throws IOException {
     // To ensure atomicity of updates to index file, write to temporary index
     // file first and then rename.
     File tmpIndexFile = getTmpIndexFile(currentTaskid, isCleanup);