Repository: oozie Updated Branches: refs/heads/branch-4.1 05eb2cd3b -> 9b9dbc4b9
OOZIE-2063 Cron syntax creates duplicate actions (bzhang) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/9b9dbc4b Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/9b9dbc4b Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/9b9dbc4b Branch: refs/heads/branch-4.1 Commit: 9b9dbc4b9b14e789a7234eaf9b72927762a495bd Parents: 05eb2cd Author: Bowen Zhang <[email protected]> Authored: Tue Nov 11 21:24:26 2014 -0800 Committer: Bowen Zhang <[email protected]> Committed: Wed Nov 12 14:06:49 2014 -0800 ---------------------------------------------------------------------- .../CoordMaterializeTransitionXCommand.java | 10 ++++++++ .../TestCoordMaterializeTransitionXCommand.java | 26 ++++++++++++++++++++ release-log.txt | 1 + 3 files changed, 37 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/9b9dbc4b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java index 23bafb8..6c9d4ae 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java @@ -483,6 +483,16 @@ public class CoordMaterializeTransitionXCommand extends MaterializeTransitionXCo } } + if (isCronFrequency) { + if (start.compareTo(end) < 0 && !(ignoreMaxActions || maxActionToBeCreated-- > 0)) { + //Since we exceed the throttle, we need to move the nextMadtime forward + //to avoid creating duplicate actions + if (!firstMater) { + start.setTime(CoordCommandUtils.getNextValidActionTimeForCronFrequency(start.getTime(), coordJob)); + } + } + } + endMatdTime = start.getTime(); if (!dryrun) { http://git-wip-us.apache.org/repos/asf/oozie/blob/9b9dbc4b/core/src/test/java/org/apache/oozie/command/coord/TestCoordMaterializeTransitionXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/oozie/command/coord/TestCoordMaterializeTransitionXCommand.java b/core/src/test/java/org/apache/oozie/command/coord/TestCoordMaterializeTransitionXCommand.java index 5b22abc..4a852cf 100644 --- a/core/src/test/java/org/apache/oozie/command/coord/TestCoordMaterializeTransitionXCommand.java +++ b/core/src/test/java/org/apache/oozie/command/coord/TestCoordMaterializeTransitionXCommand.java @@ -293,6 +293,32 @@ public class TestCoordMaterializeTransitionXCommand extends XDataTestCase { } } + public void testActionMaterwithCronFrequencyWithThrottle() throws Exception { + Date startTime = DateUtils.parseDateOozieTZ("2013-07-18T00:00Z"); + Date endTime = DateUtils.parseDateOozieTZ("2013-07-18T01:00Z"); + CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, startTime, endTime, null, + "0/10 * * * *"); + job.setMatThrottling(3); + CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, job); + + new CoordMaterializeTransitionXCommand(job.getId(), 3600).call(); + Date[] nominalTimes = new Date[] {DateUtils.parseDateOozieTZ("2013-07-18T00:00Z"), + DateUtils.parseDateOozieTZ("2013-07-18T00:10Z"), + DateUtils.parseDateOozieTZ("2013-07-18T00:20Z")}; + checkCoordActionsNominalTime(job.getId(), 3, nominalTimes); + + try { + JPAService jpaService = Services.get().get(JPAService.class); + job = jpaService.execute(new CoordJobGetJPAExecutor(job.getId())); + assertFalse(job.isDoneMaterialization()); + assertEquals(3, job.getLastActionNumber()); + assertEquals(DateUtils.parseDateOozieTZ("2013-07-18T00:30Z"), job.getNextMaterializedTime()); + } + catch (JPAExecutorException se) { + se.printStackTrace(); + fail("Job ID " + job.getId() + " was not stored properly in db"); + } + } public void testActionMaterWithDST1() throws Exception { Date startTime = DateUtils.parseDateOozieTZ("2013-03-10T08:00Z"); Date endTime = DateUtils.parseDateOozieTZ("2013-03-10T12:00Z"); http://git-wip-us.apache.org/repos/asf/oozie/blob/9b9dbc4b/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 39e54ad..65d454c 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.1.0 release (4.1 - unreleased) +OOZIE-2063 Cron syntax creates duplicate actions (bzhang) OOZIE-2032 If using SSL, the port reported by Oozie is incorrect for HA tasks (rkanter) OOZIE-1959 TestZKUtilsWithSecurity fails (rkanter) OOZIE-2033 HA and misc improvements to SSL docs (rkanter)
