From ed33ce11dd8de36fb79e103d8491d077cd4aaf77 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Thu, 19 Jan 2017 11:24:58 +0000 Subject: [PATCH] HADOOP-13496. Include file lengths in Mismatch in length error for distcp. Contributed by Ted Yu (cherry picked from commit 77401bd5fcca5127c9908156971eeec468371f47) --- .../hadoop/tools/mapred/RetriableFileCopyCommand.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableFileCopyCommand.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableFileCopyCommand.java index 82b3b62117..d1cdfdd548 100644 --- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableFileCopyCommand.java +++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableFileCopyCommand.java @@ -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,