falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject git commit: FALCON-496 Feed Replication with Empty Directories giving error. Contributed by pavan kumar kolamuri
Date Mon, 07 Jul 2014 11:54:27 GMT
Repository: incubator-falcon
Updated Branches:
  refs/heads/master 5517156e1 -> cfd647af0


FALCON-496 Feed Replication with Empty Directories giving error. Contributed by pavan kumar
kolamuri


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/cfd647af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/cfd647af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/cfd647af

Branch: refs/heads/master
Commit: cfd647af0e526d1de45b95fe7506157f868306d5
Parents: 5517156
Author: Shwetha GS <shwetha.gs@inmobi.com>
Authored: Mon Jul 7 17:24:16 2014 +0530
Committer: Shwetha GS <shwetha.gs@inmobi.com>
Committed: Mon Jul 7 17:24:16 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                           |  3 +++
 .../org/apache/falcon/replication/FeedReplicator.java | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/cfd647af/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b27964b..b8e22bd 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-496 Feed Replication with Empty Directories giving error. 
+   (pavan kumar kolamuri via Shwetha GS)
+
    FALCON-483 Fix the failing test ConfigurationStoreTest.testConcurrentRemoves 
    on jenkins. (Sowmya Ramesh via Shwetha GS)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/cfd647af/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 43cfed9..f01c46c 100644
--- a/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java
+++ b/replication/src/main/java/org/apache/falcon/replication/FeedReplicator.java
@@ -18,6 +18,7 @@
 package org.apache.falcon.replication;
 
 import org.apache.commons.cli.*;
+import org.apache.commons.lang.StringUtils;
 import org.apache.falcon.entity.EntityUtil;
 import org.apache.falcon.entity.Storage;
 import org.apache.hadoop.conf.Configuration;
@@ -142,14 +143,23 @@ public class FeedReplicator extends Configured implements Tool {
         String relativePath = includePath.toString().substring(sourcePath.toString().length());
         String fixedPath = getFixedPath(relativePath);
 
-        FileStatus[] files = fs.globStatus(new Path(targetPath.toString() + "/" + fixedPath));
+        Path finalOutputPath;
+        if (StringUtils.isNotEmpty(fixedPath)) {
+            finalOutputPath = new Path(targetPath, fixedPath);
+        } else {
+            finalOutputPath = targetPath;
+        }
+
+        FileStatus[] files = fs.globStatus(finalOutputPath);
         if (files != null) {
             for (FileStatus file : files) {
                 fs.create(new Path(file.getPath(), EntityUtil.SUCCEEDED_FILE_NAME)).close();
                 LOG.info("Created {}", new Path(file.getPath(), EntityUtil.SUCCEEDED_FILE_NAME));
             }
         } else {
-            LOG.info("No files present in path: {}", new Path(targetPath, fixedPath));
+            // As distcp is not copying empty directories we are creating  _SUCCESS file
here
+            fs.create(new Path(finalOutputPath, EntityUtil.SUCCEEDED_FILE_NAME)).close();
+            LOG.info("No files present in path: {}", finalOutputPath);
         }
     }
 


Mime
View raw message