You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ja...@apache.org on 2016/07/20 18:43:53 UTC

oozie git commit: OOZIE-2390 : Rerun with failed option removing completed output data (jaydeepvishwakarma)

Repository: oozie
Updated Branches:
  refs/heads/master 9a708c676 -> a4b375ee6


OOZIE-2390 : Rerun with failed option removing completed output data (jaydeepvishwakarma)


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

Branch: refs/heads/master
Commit: a4b375ee66dcf6c9313c8122d5feafcb85ba31bf
Parents: 9a708c6
Author: jvishwakarma <jv...@walmartlabs.com>
Authored: Thu Jul 21 00:13:27 2016 +0530
Committer: jvishwakarma <jv...@walmartlabs.com>
Committed: Thu Jul 21 00:13:27 2016 +0530

----------------------------------------------------------------------
 .../oozie/command/coord/CoordRerunXCommand.java |  3 +-
 .../command/coord/TestCoordRerunXCommand.java   | 48 +++++++++++++++++++-
 release-log.txt                                 |  1 +
 3 files changed, 50 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/a4b375ee/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
index 72e0f75..f1509e6 100644
--- a/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
+++ b/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
@@ -359,7 +359,8 @@ public class CoordRerunXCommand extends RerunTransitionXCommand<CoordinatorActio
                 try {
                     for (CoordinatorActionBean coordAction : coordActions) {
                         String actionXml = coordAction.getActionXml();
-                        if (!noCleanup) {
+                        // Cleanup activity should not run when failed option has been provided
+                        if (!noCleanup && !failed) {
                             Element eAction = XmlUtils.parseXml(actionXml);
                             cleanupOutputEvents(eAction, coordJobConf, uriHandlerContextMap);
                         }

http://git-wip-us.apache.org/repos/asf/oozie/blob/a4b375ee/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java b/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
index c199595..cdfc9d6 100644
--- a/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
+++ b/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
@@ -562,7 +562,7 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         // after cleanup
         assertFalse(fs.exists(success));
     }
-
+    
     /**
      * Test : rerun with refresh option when input dependency is hcat partition
      *
@@ -1380,6 +1380,52 @@ public class TestCoordRerunXCommand extends XDataTestCase {
         assertNotSame(externalId,coordClient.getCoordActionInfo(actionId).getExternalId());
     }
 
+
+    /**
+     * Test : -failed option of rerun. If failed option is provided it should not delete the output directories.
+     *
+     * @throws Exception
+     */
+    public void testCoordRerunWithFailedOptionDirectoryPresent() throws Exception {
+        final String jobId = "0000000-" + new Date().getTime() + "-testCoordRerun-C";
+        final int actionNum = 1;
+        final String actionId = jobId + "@" + actionNum;
+        try {
+            addRecordToJobTable(jobId, CoordinatorJob.Status.SUCCEEDED);
+            addRecordToActionTable(jobId, actionNum, actionId, CoordinatorAction.Status.SUCCEEDED,
+                    "coord-rerun-action1.xml");
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            fail("Could not update db.");
+        }
+        Path appPath = new Path(getFsTestCaseDir(), "coord");
+        String outputDir = appPath.toString() + "/coord-input/2009/12/14/11/00";
+        Path success = new Path(outputDir, "_SUCCESS");
+        FileSystem fs = getFileSystem();
+        fs.mkdirs(new Path(outputDir));
+        fs.create(success, true);
+        // before cleanup
+        assertTrue(fs.exists(success));
+
+        final OozieClient coordClient = LocalOozie.getCoordClient();
+        coordClient.reRunCoord(jobId, RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), false, false,
+                true, new Properties());
+
+        CoordinatorActionBean action2 = getCoordinatorAction(actionId);
+        assertNotSame(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
+
+        waitFor(120 * 1000, new Predicate() {
+            @Override
+            public boolean evaluate() throws Exception {
+                CoordinatorAction bean = coordClient.getCoordActionInfo(actionId);
+                return (bean.getStatus() == CoordinatorAction.Status.WAITING || bean.getStatus() == CoordinatorAction.Status.READY);
+            }
+        });
+
+        assertTrue(fs.exists(success));
+    }
+
     /**
      *  Passing config of workflow during rerun of coordinator.
      * @throws Exception

http://git-wip-us.apache.org/repos/asf/oozie/blob/a4b375ee/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 56bd515..ca4714f 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.0 release (trunk - unreleased)
 
+OOZIE-2390 Rerun with failed option removing completed output data (jaydeepvishwakarma)
 OOZIE-2462 When calling ParamChecker.notNull() in CoordActionsIgnoreXCommand.java, "Action" should be passed instead of "Action cannot be null" (mballur via jaydeepvishwakarma)
 OOZIE-2507 Expose monitoring via JMX beans in Oozie (fdenes via rkanter)
 OOZIE-2581 Oozie should reset SecurityManager in finally block (satishsaley via rohini)