Author: virag
Date: Fri Nov 30 04:44:34 2012
New Revision: 1415499
URL: http://svn.apache.org/viewvc?rev=1415499&view=rev
Log:
OOZIE-1065 bundle status does not transit after rerun (virag)
Modified:
oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
oozie/branches/branch-3.3/release-log.txt
Modified:
oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java?rev=1415499&r1=1415498&r2=1415499&view=diff
==============================================================================
---
oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
(original)
+++
oozie/branches/branch-3.3/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
Fri Nov 30 04:44:34 2012
@@ -281,9 +281,15 @@ 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) {
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
+ if (coordJob.getBundleId() != null) {
+ bundleStatusUpdate.call();
+ }
throw new CommandException(ErrorCode.E1018,
"coordinator job is killed or failed so all actions are
not eligible to rerun!");
}
@@ -291,6 +297,11 @@ public class CoordRerunXCommand extends
// no actioins have been created for PREP job
if (coordJob.getStatus() == CoordinatorJob.Status.PREP) {
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
+ if (coordJob.getBundleId() != null) {
+ bundleStatusUpdate.call();
+ }
throw new CommandException(ErrorCode.E1018,
"coordinator job is PREP so no actions are materialized to
rerun!");
}
Modified:
oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java?rev=1415499&r1=1415498&r2=1415499&view=diff
==============================================================================
---
oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
(original)
+++
oozie/branches/branch-3.3/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
Fri Nov 30 04:44:34 2012
@@ -19,10 +19,12 @@ package org.apache.oozie.command.bundle;
import java.util.Date;
+import org.apache.oozie.BundleActionBean;
import org.apache.oozie.BundleJobBean;
import org.apache.oozie.CoordinatorJobBean;
import org.apache.oozie.client.CoordinatorJob;
import org.apache.oozie.client.Job;
+import org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor;
import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
import org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor;
import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
@@ -99,6 +101,30 @@ public class TestBundleRerunXCommand ext
assertEquals(Job.Status.RUNNING, job.getStatus());
}
+
+ /**
+ * Test : Rerun bundle job with a killed coordinator. Make sure the bundle
action pending flag is reset.
+ *
+ * @throws Exception
+ */
+ public void testBundleRerunKilledCoordinator() throws Exception {
+ BundleJobBean job =
this.addRecordToBundleJobTable(Job.Status.DONEWITHERROR, false);
+ String bundleId = job.getId();
+ addRecordToBundleActionTable(bundleId, "action1", 0,
Job.Status.KILLED);
+ addRecordToCoordJobTableWithBundle(bundleId, "action1",
CoordinatorJob.Status.KILLED, false, false, 1);
+
+ JPAService jpaService = Services.get().get(JPAService.class);
+ assertNotNull(jpaService);
+
+ new BundleRerunXCommand(bundleId, "action1", null, false, true).call();
+
+ sleep(1000);
+
+ BundleActionGetJPAExecutor bundleActionJPA = new
BundleActionGetJPAExecutor(bundleId, "action1");
+ BundleActionBean ba = jpaService.execute(bundleActionJPA);
+ assertEquals(0, ba.getPending());
+ }
+
/**
* Test : Rerun a DONEWITHERROR bundle job. Status should
* change to RUNNINGWITHERROR
Modified: oozie/branches/branch-3.3/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-3.3/release-log.txt?rev=1415499&r1=1415498&r2=1415499&view=diff
==============================================================================
--- oozie/branches/branch-3.3/release-log.txt (original)
+++ oozie/branches/branch-3.3/release-log.txt Fri Nov 30 04:44:34 2012
@@ -1,5 +1,6 @@
-- Oozie 3.3.0 release
+OOZIE-1065 bundle status does not transit after rerun (virag)
OOZIE-1064 Status value of coordinator job not reflected in bundle action and
invalid transition of coordinator job (virag)
OOZIE-1089 DistributedCache workaround for Hadoop 2.0.2-alpha (tucu)
OOZIE-1005 Tests from OOZIE-994 use wrong condition in waitFor (rkanter via
virag)