hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r701308 - in /hadoop/core/branches/branch-0.19: CHANGES.txt src/tools/org/apache/hadoop/tools/DistCp.java
Date Fri, 03 Oct 2008 06:06:54 GMT
Author: szetszwo
Date: Thu Oct  2 23:06:54 2008
New Revision: 701308

URL: http://svn.apache.org/viewvc?rev=701308&view=rev
Log:
HADOOP-4318. DistCp should use absolute paths for cleanup.  (szetszwo)

Modified:
    hadoop/core/branches/branch-0.19/CHANGES.txt
    hadoop/core/branches/branch-0.19/src/tools/org/apache/hadoop/tools/DistCp.java

Modified: hadoop/core/branches/branch-0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/CHANGES.txt?rev=701308&r1=701307&r2=701308&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.19/CHANGES.txt Thu Oct  2 23:06:54 2008
@@ -1628,6 +1628,8 @@
     HADOOP-4271. Checksum input stream can sometimes return invalid 
     data to the user. (Ning Li via rangadi)
 
+    HADOOP-4318. DistCp should use absolute paths for cleanup.  (szetszwo)
+
 Release 0.17.2 - 2008-08-11
 
   BUG FIXES

Modified: hadoop/core/branches/branch-0.19/src/tools/org/apache/hadoop/tools/DistCp.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/tools/org/apache/hadoop/tools/DistCp.java?rev=701308&r1=701307&r2=701308&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/src/tools/org/apache/hadoop/tools/DistCp.java (original)
+++ hadoop/core/branches/branch-0.19/src/tools/org/apache/hadoop/tools/DistCp.java Thu Oct
 2 23:06:54 2008
@@ -344,8 +344,11 @@
     
     private FSDataOutputStream create(Path f, Reporter reporter,
         FileStatus srcstat) throws IOException {
+      if (destFileSys.exists(f)) {
+        destFileSys.delete(f, false);
+      }
       if (!preserve_status) {
-        return destFileSys.create(f, reporter);
+        return destFileSys.create(f, true, sizeBuf, reporter);
       }
 
       FsPermission permission = preseved.contains(FileAttribute.PERMISSION)?
@@ -527,22 +530,23 @@
                     FilePair value,
                     OutputCollector<WritableComparable<?>, Text> out,
                     Reporter reporter) throws IOException {
-      FileStatus srcstat = value.input;
-      Path dstpath = new Path(value.output);
+      final FileStatus srcstat = value.input;
+      final Path relativedst = new Path(value.output);
       try {
-        copy(srcstat, dstpath, out, reporter);
+        copy(srcstat, relativedst, out, reporter);
       } catch (IOException e) {
         ++failcount;
         reporter.incrCounter(Counter.FAIL, 1);
         updateStatus(reporter);
-        final String sfailure = "FAIL " + dstpath + " : " +
+        final String sfailure = "FAIL " + relativedst + " : " +
                           StringUtils.stringifyException(e);
         out.collect(null, new Text(sfailure));
         LOG.info(sfailure);
         try {
           for (int i = 0; i < 3; ++i) {
             try {
-              if (destFileSys.delete(dstpath, true))
+              final Path tmp = new Path(job.get(TMP_DIR_LABEL), relativedst);
+              if (destFileSys.delete(tmp, true))
                 break;
             } catch (Throwable ex) {
               // ignore, we are just cleaning up



Mime
View raw message