Repository: falcon Updated Branches: refs/heads/master 8f2c0fc7f -> 7e554e791
FALCON-1844 Replication to delete files removed in source by default Author: Pallavi Rao <[email protected]> Reviewers: Pavan Kolamuri <[email protected]>, Sandeep Samudrala<[email protected]>, Peeyush Bishnoi<[email protected]> Closes #60 from pallavi-rao/1844 Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/7e554e79 Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/7e554e79 Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/7e554e79 Branch: refs/heads/master Commit: 7e554e7913a8b411f462c333cc67cdd307c6ff87 Parents: 8f2c0fc Author: Pallavi Rao <[email protected]> Authored: Thu Mar 3 16:00:07 2016 +0530 Committer: Pallavi Rao <[email protected]> Committed: Thu Mar 3 16:00:07 2016 +0530 ---------------------------------------------------------------------- .../java/org/apache/falcon/replication/FeedReplicator.java | 8 ++++---- .../org/apache/falcon/replication/FeedReplicatorTest.java | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/7e554e79/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java ---------------------------------------------------------------------- diff --git a/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java b/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java index bbf7321..a8da51d 100644 --- a/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java +++ b/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java @@ -211,11 +211,11 @@ public class FeedReplicator extends Configured implements Tool { distcpOptions.setSkipCRC(Boolean.parseBoolean(skipChecksum)); } + // Removing deleted files by default - FALCON-1844 String removeDeletedFiles = cmd.getOptionValue( - ReplicationDistCpOption.DISTCP_OPTION_REMOVE_DELETED_FILES.getName()); - if (StringUtils.isNotEmpty(removeDeletedFiles)) { - distcpOptions.setDeleteMissing(Boolean.parseBoolean(removeDeletedFiles)); - } + ReplicationDistCpOption.DISTCP_OPTION_REMOVE_DELETED_FILES.getName(), "true"); + distcpOptions.setDeleteMissing(Boolean.parseBoolean(removeDeletedFiles)); + String preserveBlockSize = cmd.getOptionValue( ReplicationDistCpOption.DISTCP_OPTION_PRESERVE_BLOCK_SIZE.getName()); http://git-wip-us.apache.org/repos/asf/falcon/blob/7e554e79/replication/src/test/java/org/apache/falcon/replication/FeedReplicatorTest.java ---------------------------------------------------------------------- diff --git a/replication/src/test/java/org/apache/falcon/replication/FeedReplicatorTest.java b/replication/src/test/java/org/apache/falcon/replication/FeedReplicatorTest.java index 9cfeb30..e7e177e 100644 --- a/replication/src/test/java/org/apache/falcon/replication/FeedReplicatorTest.java +++ b/replication/src/test/java/org/apache/falcon/replication/FeedReplicatorTest.java @@ -58,6 +58,7 @@ public class FeedReplicatorTest { List<Path> srcPaths = new ArrayList<Path>(); srcPaths.add(new Path("hdfs://localhost:8020/tmp/")); validateMandatoryArguments(options, srcPaths, true); + Assert.assertTrue(options.shouldDeleteMissing()); } @Test @@ -87,7 +88,7 @@ public class FeedReplicatorTest { "-overwrite", "true", "-ignoreErrors", "false", "-skipChecksum", "false", - "-removeDeletedFiles", "true", + "-removeDeletedFiles", "false", "-preserveBlockSize", "false", "-preserveReplicationNumber", "true", "-preservePermission", "false", @@ -115,7 +116,7 @@ public class FeedReplicatorTest { Assert.assertTrue(options.shouldOverwrite()); Assert.assertFalse(options.shouldIgnoreFailures()); Assert.assertFalse(options.shouldSkipCRC()); - Assert.assertTrue(options.shouldDeleteMissing()); + Assert.assertFalse(options.shouldDeleteMissing()); Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.BLOCKSIZE)); Assert.assertTrue(options.shouldPreserve(DistCpOptions.FileAttribute.REPLICATION)); Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.PERMISSION));
