瀏覽代碼

HADOOP-1396. Fix FileNotFoundException on DFS block. Contributed by Dhruba Borthakur.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@547031 13f79535-47bb-0310-9956-ffa450edef68
Thomas White 18 年之前
父節點
當前提交
77430ffa3d
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 3 0
      CHANGES.txt
  2. 5 3
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 3 - 0
CHANGES.txt

@@ -111,6 +111,9 @@ Trunk (unreleased changes)
      the namenode to ignore the load on datanodes while allocating
      the namenode to ignore the load on datanodes while allocating
      replicas.  (Dhruba Borthakur via tomwhite)
      replicas.  (Dhruba Borthakur via tomwhite)
 
 
+ 36. HADOOP-1396.  Fix FileNotFoundException on DFS block.
+     (Dhruba Borthakur via tomwhite)
+
 
 
 Release 0.13.0 - 2007-06-08
 Release 0.13.0 - 2007-06-08
 
 

+ 5 - 3
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -1167,9 +1167,11 @@ class DFSClient implements FSConstants {
     }
     }
         
         
     private File newBackupFile() throws IOException {
     private File newBackupFile() throws IOException {
-      File result = conf.getFile("dfs.client.buffer.dir",
-                                 "tmp"+File.separator+
-                                 "client-"+Math.abs(r.nextLong()));
+      File file = conf.getFile("dfs.client.buffer.dir", "tmp");
+      File dir = file.getParentFile();
+      String prefix = "client-" + Math.abs(r.nextLong());
+      String suffix = ".tmp";
+      File result = File.createTempFile(prefix, suffix, dir);
       result.deleteOnExit();
       result.deleteOnExit();
       return result;
       return result;
     }
     }