HADOOP-13163 Reuse pre-computed filestatus in Distcp-CopyMapper (Rajesh Balamohan via stevel)
This commit is contained in:
parent
19db965c27
commit
dfc062a092
|
@ -245,7 +245,7 @@ public class CopyMapper extends Mapper<Text, CopyListingFileStatus, Text, Text>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAction action = checkUpdate(sourceFS, sourceCurrStatus, target);
|
FileAction action = checkUpdate(sourceFS, sourceCurrStatus, target, targetStatus);
|
||||||
if (action == FileAction.SKIP) {
|
if (action == FileAction.SKIP) {
|
||||||
LOG.info("Skipping copy of " + sourceCurrStatus.getPath()
|
LOG.info("Skipping copy of " + sourceCurrStatus.getPath()
|
||||||
+ " to " + target);
|
+ " to " + target);
|
||||||
|
@ -332,13 +332,7 @@ public class CopyMapper extends Mapper<Text, CopyListingFileStatus, Text, Text>
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileAction checkUpdate(FileSystem sourceFS, FileStatus source,
|
private FileAction checkUpdate(FileSystem sourceFS, FileStatus source,
|
||||||
Path target) throws IOException {
|
Path target, FileStatus targetFileStatus) throws IOException {
|
||||||
final FileStatus targetFileStatus;
|
|
||||||
try {
|
|
||||||
targetFileStatus = targetFS.getFileStatus(target);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
return FileAction.OVERWRITE;
|
|
||||||
}
|
|
||||||
if (targetFileStatus != null && !overWrite) {
|
if (targetFileStatus != null && !overWrite) {
|
||||||
if (canSkip(sourceFS, source, targetFileStatus)) {
|
if (canSkip(sourceFS, source, targetFileStatus)) {
|
||||||
return FileAction.SKIP;
|
return FileAction.SKIP;
|
||||||
|
|
Loading…
Reference in New Issue