Author: virag
Date: Tue Oct 29 16:24:19 2013
New Revision: 1536795

URL: http://svn.apache.org/r1536795
Log:
OOZIE-1562 Allow re-run of actions of killed coordinator (shwethags via virag)

Modified:
    
oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
    
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
    oozie/trunk/release-log.txt

Modified: 
oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java?rev=1536795&r1=1536794&r2=1536795&view=diff
==============================================================================
--- 
oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
 (original)
+++ 
oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
 Tue Oct 29 16:24:19 2013
@@ -262,8 +262,7 @@ public class CoordRerunXCommand extends 
     @Override
     protected void verifyPrecondition() throws CommandException, 
PreconditionException {
         BundleStatusUpdateXCommand bundleStatusUpdate = new 
BundleStatusUpdateXCommand(coordJob, coordJob.getStatus());
-        if (coordJob.getStatus() == CoordinatorJob.Status.KILLED
-                || coordJob.getStatus() == CoordinatorJob.Status.FAILED) {
+        if (coordJob.getStatus() == CoordinatorJob.Status.FAILED) {
             LOG.info("CoordRerunXCommand is not able to run, job status=" + 
coordJob.getStatus() + ", jobid=" + jobId);
             // Call the parent so the pending flag is reset and state 
transition
             // of bundle can happen
@@ -271,7 +270,7 @@ public class CoordRerunXCommand extends 
                 bundleStatusUpdate.call();
             }
             throw new CommandException(ErrorCode.E1018,
-                    "coordinator job is killed or failed so all actions are 
not eligible to rerun!");
+                    "coordinator job is failed. So all actions are not 
eligible to rerun!");
         }
 
         // no actioins have been created for PREP job

Modified: 
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
URL: 
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java?rev=1536795&r1=1536794&r2=1536795&view=diff
==============================================================================
--- 
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
 (original)
+++ 
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
 Tue Oct 29 16:24:19 2013
@@ -778,11 +778,11 @@ public class TestCoordRerunXCommand exte
     }
 
     /**
-     * Negative Test : rerun <jobId> -action 1 -nocleanup. Coordinator job is 
killed, so no actions are able to rerun.
+     * rerun <jobId> -action 1 -nocleanup. Coordinator job is killed, but 
actions are able to rerun.
      *
      * @throws Exception
      */
-    public void testCoordRerunNeg() throws Exception {
+    public void testCoordRerunKilledCoord() throws Exception {
         final String jobId = "0000000-" + new Date().getTime() + 
"-testCoordRerun-C";
         final int actionNum = 1;
         final String actionId = jobId + "@" + actionNum;
@@ -806,18 +806,16 @@ public class TestCoordRerunXCommand exte
             final OozieClient coordClient = LocalOozie.getCoordClient();
             coordClient.reRunCoord(jobId, 
RestConstants.JOB_COORD_SCOPE_ACTION, Integer.toString(actionNum), false,
                     true);
-            fail("Exception expected because action is not in terminal 
state.");
         }
         catch (OozieClientException ex) {
-            if (!ex.getErrorCode().equals(ErrorCode.E1018.toString())) {
-                fail("Error code should be E1018 when job is killed or 
failed.");
-            }
+            ex.printStackTrace();
+            fail("Coord rerun failed");
         }
 
         CoordinatorStore store2 = 
Services.get().get(StoreService.class).getStore(CoordinatorStore.class);
         store2.beginTrx();
         CoordinatorActionBean action2 = store2.getCoordinatorAction(actionId, 
false);
-        assertEquals(action2.getStatus(), CoordinatorAction.Status.SUCCEEDED);
+        assertEquals(action2.getStatus(), CoordinatorAction.Status.WAITING);
         store2.commitTrx();
         store2.closeTrx();
     }

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1536795&r1=1536794&r2=1536795&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Tue Oct 29 16:24:19 2013
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1562 Allow re-run of actions of killed coordinator (shwethags via virag)
 OOZIE-1597 Cleanup database before every test (rkanter)
 OOZIE-1589 TestZKLocksService is flakey (rkanter)
 OOZIE-1541 Typo in Oozie HA admin -servers command in documentation (rkanter)


Reply via email to