aasha commented on a change in pull request #1530: HDFS-14869 Copy renamed files which are not excluded anymore by filter URL: https://github.com/apache/hadoop/pull/1530#discussion_r337418551
########## File path: hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpSync.java ########## @@ -213,18 +216,30 @@ private boolean getAllDiffs() throws IOException { } SnapshotDiffReport.DiffType dt = entry.getType(); List<DiffInfo> list = diffMap.get(dt); + final Path source = + new Path(DFSUtilClient.bytes2String(entry.getSourcePath())); + final Path relativeSource = new Path(Path.SEPARATOR + source); if (dt == SnapshotDiffReport.DiffType.MODIFY || - dt == SnapshotDiffReport.DiffType.CREATE || - dt == SnapshotDiffReport.DiffType.DELETE) { - final Path source = - new Path(DFSUtilClient.bytes2String(entry.getSourcePath())); - list.add(new DiffInfo(source, null, dt)); + dt == SnapshotDiffReport.DiffType.CREATE || + dt == SnapshotDiffReport.DiffType.DELETE) { + if (copyFilter.shouldCopy(relativeSource)) { + list.add(new DiffInfo(source, null, dt)); + } } else if (dt == SnapshotDiffReport.DiffType.RENAME) { - final Path source = - new Path(DFSUtilClient.bytes2String(entry.getSourcePath())); final Path target = - new Path(DFSUtilClient.bytes2String(entry.getTargetPath())); - list.add(new DiffInfo(source, target, dt)); + new Path(DFSUtilClient.bytes2String(entry.getTargetPath())); + final Path relativeTarget = new Path(Path.SEPARATOR + target); + if (copyFilter.shouldCopy(relativeSource)) { + if (copyFilter.shouldCopy(relativeTarget)) { + list.add(new DiffInfo(source, target, dt)); Review comment: bytes2String is present in the source and target paths. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org