|
@@ -382,13 +382,11 @@ public class CopyFiles implements Tool {
|
|
checkAndClose(out);
|
|
checkAndClose(out);
|
|
}
|
|
}
|
|
|
|
|
|
- final boolean success = cbcopied == srcstat.getLen();
|
|
|
|
- if (!success) {
|
|
|
|
- final String badlen = "ERROR? copied " + bytesString(cbcopied)
|
|
|
|
- + " but expected " + bytesString(srcstat.getLen())
|
|
|
|
- + " from " + srcstat.getPath();
|
|
|
|
- LOG.warn(badlen);
|
|
|
|
- outc.collect(null, new Text(badlen));
|
|
|
|
|
|
+ if (cbcopied != srcstat.getLen()) {
|
|
|
|
+ throw new IOException("File size not matched: copied "
|
|
|
|
+ + bytesString(cbcopied) + " to tmpfile (=" + tmpfile
|
|
|
|
+ + ") but expected " + bytesString(srcstat.getLen())
|
|
|
|
+ + " from " + srcstat.getPath());
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
if (totfiles == 1) {
|
|
if (totfiles == 1) {
|
|
@@ -408,7 +406,16 @@ public class CopyFiles implements Tool {
|
|
throw new IOException("Failed to craete parent dir: " + absdst.getParent());
|
|
throw new IOException("Failed to craete parent dir: " + absdst.getParent());
|
|
}
|
|
}
|
|
rename(tmpfile, absdst);
|
|
rename(tmpfile, absdst);
|
|
- updatePermissions(srcstat, destFileSys.getFileStatus(absdst));
|
|
|
|
|
|
+
|
|
|
|
+ FileStatus dststat = destFileSys.getFileStatus(absdst);
|
|
|
|
+ if (dststat.getLen() != srcstat.getLen()) {
|
|
|
|
+ destFileSys.delete(absdst, false);
|
|
|
|
+ throw new IOException("File size not matched: copied "
|
|
|
|
+ + bytesString(dststat.getLen()) + " to dst (=" + absdst
|
|
|
|
+ + ") but expected " + bytesString(srcstat.getLen())
|
|
|
|
+ + " from " + srcstat.getPath());
|
|
|
|
+ }
|
|
|
|
+ updatePermissions(srcstat, dststat);
|
|
}
|
|
}
|
|
|
|
|
|
// report at least once for each file
|
|
// report at least once for each file
|