HADOOP-13496. Include file lengths in Mismatch in length error for distcp. Contributed by Ted Yu

(cherry picked from commit 77401bd5fcca5127c9908156971eeec468371f47)
This commit is contained in:
Steve Loughran 2017-01-19 11:24:58 +00:00
parent 1763467210
commit ed33ce11dd

View File

@ -189,9 +189,10 @@ private void compareFileLengths(CopyListingFileStatus source, Path target,
throws IOException {
final Path sourcePath = source.getPath();
FileSystem fs = sourcePath.getFileSystem(configuration);
if (fs.getFileStatus(sourcePath).getLen() != targetLen)
throw new IOException("Mismatch in length of source:" + sourcePath
+ " and target:" + target);
long srcLen = fs.getFileStatus(sourcePath).getLen();
if (srcLen != targetLen)
throw new IOException("Mismatch in length of source:" + sourcePath + " (" + srcLen +
") and target:" + target + " (" + targetLen + ")");
}
private void compareCheckSums(FileSystem sourceFS, Path source,