浏览代码

MAPREDUCE-2846. Fix missing synchronization in the task log management.
(omalley)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1161324 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 13 年之前
父节点
当前提交
ebf61db566

+ 4 - 1
hadoop-mapreduce/CHANGES.txt

@@ -1133,7 +1133,10 @@ Trunk (unreleased changes)
     MAPREDUCE-2838. Fix MapReduce builds to use new hadoop-common test jars.
     (gkesavan via acmurthy) 
    
-    MAPREDUCE-2859 - Fix eclipse plugin contrib module compilation (gkesavan) 
+    MAPREDUCE-2859. Fix eclipse plugin contrib module compilation (gkesavan) 
+
+    MAPREDUCE-2846. Fix missing synchronization in the task log management.
+    (omalley)
 
 Release 0.22.0 - Unreleased
 

+ 3 - 3
hadoop-mapreduce/hadoop-mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java

@@ -183,9 +183,9 @@ public class TaskLog {
   private static long prevErrLength;
   private static long prevLogLength;
   
-  private static void writeToIndexFile(String logLocation,
-                                       boolean isCleanup) 
-  throws IOException {
+  private static synchronized 
+  void writeToIndexFile(String logLocation,
+                        boolean isCleanup) throws IOException {
     // To ensure atomicity of updates to index file, write to temporary index
     // file first and then rename.
     File tmpIndexFile = getTmpIndexFile(currentTaskid, isCleanup);