hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r816490 - in /hadoop/mapreduce/trunk: CHANGES.txt src/tools/org/apache/hadoop/tools/DistCp.java
Date Fri, 18 Sep 2009 06:53:25 GMT
Author: cdouglas
Date: Fri Sep 18 06:53:25 2009
New Revision: 816490

URL: http://svn.apache.org/viewvc?rev=816490&view=rev
Log:
MAPREDUCE-645. Prevent distcp from running a job when the destination is a
file, but the source is not. Contributed by Ravi Gummadi

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/tools/org/apache/hadoop/tools/DistCp.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=816490&r1=816489&r2=816490&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Fri Sep 18 06:53:25 2009
@@ -644,3 +644,5 @@
     MAPREDUCE-953. Fix QueueManager to dump queue configuration in JSON format.
     (V.V. Chaitanya Krishna via yhemanth)
 
+    MAPREDUCE-645. Prevent distcp from running a job when the destination is a
+    file, but the source is not. (Ravi Gummadi via cdouglas)

Modified: hadoop/mapreduce/trunk/src/tools/org/apache/hadoop/tools/DistCp.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/tools/org/apache/hadoop/tools/DistCp.java?rev=816490&r1=816489&r2=816490&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/tools/org/apache/hadoop/tools/DistCp.java (original)
+++ hadoop/mapreduce/trunk/src/tools/org/apache/hadoop/tools/DistCp.java Fri Sep 18 06:53:25
2009
@@ -1259,7 +1259,14 @@
         FileSystem srcfs = src.getFileSystem(conf);
         FileStatus srcfilestat = srcfs.getFileStatus(src);
         Path root = special && srcfilestat.isDir()? src: src.getParent();
-    
+        if (dstExists && !dstIsDir &&
+            (args.srcs.size() > 1 || srcfilestat.isDir())) {
+          // destination should not be a file
+          throw new IOException("Destination " + args.dst + " should be a dir" +
+                                " if multiple source paths are there OR if" +
+                                " the source path is a dir");
+        }
+
         if (basedir != null) {
           root = basedir;
           Path parent = src.getParent().makeQualified(srcfs);



Mime
View raw message