From c69a649257a331da55c1a1bf61c819e289015a6b Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 17 May 2016 12:59:59 +0100 Subject: [PATCH] HADOOP-13163 Reuse pre-computed filestatus in Distcp-CopyMapper (Rajesh Balamohan via stevel) --- .../org/apache/hadoop/tools/mapred/CopyMapper.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyMapper.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyMapper.java index 4db1d4eb46..4b73415bb8 100644 --- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyMapper.java +++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyMapper.java @@ -182,7 +182,7 @@ public void map(Text relPath, CopyListingFileStatus sourceFileStatus, return; } - FileAction action = checkUpdate(sourceFS, sourceCurrStatus, target); + FileAction action = checkUpdate(sourceFS, sourceCurrStatus, target, targetStatus); if (action == FileAction.SKIP) { LOG.info("Skipping copy of " + sourceCurrStatus.getPath() + " to " + target); @@ -270,13 +270,7 @@ private static void incrementCounter(Context context, Counter counter, } private FileAction checkUpdate(FileSystem sourceFS, FileStatus source, - Path target) throws IOException { - final FileStatus targetFileStatus; - try { - targetFileStatus = targetFS.getFileStatus(target); - } catch (FileNotFoundException e) { - return FileAction.OVERWRITE; - } + Path target, FileStatus targetFileStatus) throws IOException { if (targetFileStatus != null && !overWrite) { if (canSkip(sourceFS, source, targetFileStatus)) { return FileAction.SKIP;