Prechádzať zdrojové kódy

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

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/branches/branch-0.13@558872 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 rokov pred
rodič
commit
c9040f4a01

+ 3 - 0
CHANGES.txt

@@ -16,6 +16,9 @@ Release 0.13.1 - 2007-07-25
  4. HADOOP-1638.  Fix contrib EC2 scripts to support NAT addressing.
     (Stu Hood via tomwhite) 
 
+ 5. HADOOP-1396.  Fix FileNotFoundException on DFS block.
+    (Dhruba Borthakur via cutting)
+
 
 Release 0.13.0 - 2007-06-08
 

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

@@ -1097,9 +1097,11 @@ class DFSClient implements FSConstants {
     }
         
     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();
       return result;
     }