You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sz...@apache.org on 2008/10/03 08:12:22 UTC
svn commit: r701311 - in /hadoop/core/branches/branch-0.18: CHANGES.txt
src/tools/org/apache/hadoop/tools/DistCp.java
Author: szetszwo
Date: Thu Oct 2 23:12:22 2008
New Revision: 701311
URL: http://svn.apache.org/viewvc?rev=701311&view=rev
Log:
HADOOP-4318. DistCp should use absolute paths for cleanup. (szetszwo)
Modified:
hadoop/core/branches/branch-0.18/CHANGES.txt
hadoop/core/branches/branch-0.18/src/tools/org/apache/hadoop/tools/DistCp.java
Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=701311&r1=701310&r2=701311&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Thu Oct 2 23:12:22 2008
@@ -844,6 +844,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.18/src/tools/org/apache/hadoop/tools/DistCp.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/tools/org/apache/hadoop/tools/DistCp.java?rev=701311&r1=701310&r2=701311&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/tools/org/apache/hadoop/tools/DistCp.java (original)
+++ hadoop/core/branches/branch-0.18/src/tools/org/apache/hadoop/tools/DistCp.java Thu Oct 2 23:12:22 2008
@@ -315,8 +315,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)?
@@ -498,22 +501,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