Просмотр исходного кода

Merge -r 723459:723460 from main to move the change log of HADOOP-4746 to branch 0.18.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.18@723462 13f79535-47bb-0310-9956-ffa450edef68
Hairong Kuang 16 лет назад
Родитель
Сommit
1b192902b9

+ 2 - 0
CHANGES.txt

@@ -69,6 +69,8 @@ Release 0.18.3 - Unreleased
     HADOOP-4734. Block and meta data validation codes in HADOOP-1700 should be
     committed to 0.18. (szetszwo)
 
+    HADOOP-4746. Job output directory should be normalized. (hairong)
+
 Release 0.18.2 - 2008-11-03
 
   BUG FIXES

+ 1 - 1
src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java

@@ -3189,8 +3189,8 @@ class FSNamesystem implements FSConstants, FSNamesystemMBean {
     //
     // Modify the blocks->datanode map and node's map.
     // 
-    addStoredBlock(block, node, delHintNode );
     pendingReplications.remove(block);
+    addStoredBlock(block, node, delHintNode );
   }
 
   long[] getStats() throws IOException {

+ 10 - 3
src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java

@@ -100,9 +100,16 @@ public abstract class FileOutputFormat<K, V> implements OutputFormat<K, V> {
     if (outDir == null && job.getNumReduceTasks() != 0) {
       throw new InvalidJobConfException("Output directory not set in JobConf.");
     }
-    if (outDir != null && outDir.getFileSystem(job).exists(outDir)) {
-      throw new FileAlreadyExistsException("Output directory " + outDir + 
-                                           " already exists");
+    if (outDir != null) {
+      FileSystem fs = outDir.getFileSystem(job);
+      // normalize the output directory
+      outDir = fs.makeQualified(outDir);
+      setOutputPath(job, outDir);
+      // check its existence
+      if (fs.exists(outDir)) {
+        throw new FileAlreadyExistsException("Output directory " + outDir + 
+                                             " already exists");
+      }
     }
   }