hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r634417 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
Date Thu, 06 Mar 2008 21:14:26 GMT
Author: cdouglas
Date: Thu Mar  6 13:14:23 2008
New Revision: 634417

URL: http://svn.apache.org/viewvc?rev=634417&view=rev
Log:
HADOOP-730. Use renameTo rather than copy for local renames.


Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=634417&r1=634416&r2=634417&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Mar  6 13:14:23 2008
@@ -66,6 +66,8 @@
     HADOOP-2833. Do not use "Dr. Who" as the default user in JobClient. 
     A valid user name is required. (Tsz Wo (Nicholas), SZE via rangadi)
 
+    HADOOP-730. Use rename rather than copy for local renames. (cdouglas)
+
   OPTIMIZATIONS
 
     HADOOP-2790.  Fixed inefficient method hasSpeculativeTask by removing

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=634417&r1=634416&r2=634417&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java Thu Mar  6 13:14:23
2008
@@ -42,8 +42,6 @@
   TreeMap<File, FileOutputStream> nonsharedLockDataSet =
     new TreeMap<File, FileOutputStream>();
   TreeMap<File, FileLock> lockObjSet = new TreeMap<File, FileLock>();
-  // by default use copy/delete instead of rename
-  boolean useCopyForRename = true;
   
   public RawLocalFileSystem() {
     workingDir = new Path(System.getProperty("user.dir")).makeQualified(this);
@@ -207,9 +205,10 @@
   }
   
   public boolean rename(Path src, Path dst) throws IOException {
-    if (useCopyForRename) {
-      return FileUtil.copy(this, src, this, dst, true, getConf());
-    } else return pathToFile(src).renameTo(pathToFile(dst));
+    if (pathToFile(src).renameTo(pathToFile(dst))) {
+      return true;
+    }
+    return FileUtil.copy(this, src, this, dst, true, getConf());
   }
   
   public boolean delete(Path p) throws IOException {



Mime
View raw message