Explorar o código

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 %!s(int64=18) %!d(string=hai) anos
pai
achega
77430ffa3d
Modificáronse 2 ficheiros con 8 adicións e 3 borrados
  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;
     }
     }