You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by ve...@apache.org on 2014/03/26 07:42:36 UTC
git commit: FALCON-378 Feed status fails with NPE post update when
the new coordinator is in PREP state. Contributed by Venkatesh Seetharam
Repository: incubator-falcon
Updated Branches:
refs/heads/master 5cd371009 -> c9792ede5
FALCON-378 Feed status fails with NPE post update when the new coordinator is in PREP state. Contributed by Venkatesh Seetharam
Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/c9792ede
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/c9792ede
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/c9792ede
Branch: refs/heads/master
Commit: c9792ede54c804a925a235829c374eaa1414b692
Parents: 5cd3710
Author: Venkatesh Seetharam <ve...@hortonworks.com>
Authored: Tue Mar 25 23:42:53 2014 -0700
Committer: Venkatesh Seetharam <ve...@hortonworks.com>
Committed: Tue Mar 25 23:42:53 2014 -0700
----------------------------------------------------------------------
CHANGES.txt | 3 ++
.../workflow/engine/OozieWorkflowEngine.java | 30 +++++++++++++-------
2 files changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/c9792ede/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index efb4b4f..1039ce9 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -185,6 +185,9 @@ Trunk (Unreleased)
FALCON-360 Lineage recording fails with NPE for processes with >1 inputs.
(Venkatesh Seetharam)
+ FALCON-378 Feed status fails with NPE post update when the new coordinator
+ is in PREP state (Venkatesh Seetharam)
+
Release Version: 0.4-incubating
NEW FEATURES
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/c9792ede/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java
----------------------------------------------------------------------
diff --git a/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java
index d819e93..9d4103b 100644
--- a/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java
+++ b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java
@@ -753,22 +753,29 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine {
List<CoordinatorAction> actions = new ArrayList<CoordinatorAction>();
for (CoordinatorJob coord : applicableCoords) {
+ Date nextMaterializedTime = coord.getNextMaterializedTime();
+ if (nextMaterializedTime == null) {
+ continue;
+ }
+
Frequency freq = createFrequency(String.valueOf(coord.getFrequency()), coord.getTimeUnit());
TimeZone tz = EntityUtil.getTimeZone(coord.getTimeZone());
Date iterStart = EntityUtil.getNextStartTime(coord.getStartTime(), freq, tz, start);
- Date iterEnd = (coord.getNextMaterializedTime().before(end) ? coord.getNextMaterializedTime() : end);
+ Date iterEnd = (nextMaterializedTime.before(end) ? nextMaterializedTime : end);
+
while (!iterStart.after(iterEnd)) {
int sequence = EntityUtil.getInstanceSequence(coord.getStartTime(), freq, tz, iterStart);
String actionId = coord.getId() + "@" + sequence;
- CoordinatorAction coordActionInfo = null;
+
try {
- coordActionInfo = client.getCoordActionInfo(actionId);
+ CoordinatorAction coordActionInfo = client.getCoordActionInfo(actionId);
+ if (coordActionInfo != null) {
+ actions.add(coordActionInfo);
+ }
} catch (OozieClientException e) {
LOG.debug("Unable to get action for " + actionId + " " + e.getMessage());
}
- if (coordActionInfo != null) {
- actions.add(coordActionInfo);
- }
+
Calendar startCal = Calendar.getInstance(EntityUtil.getTimeZone(coord.getTimeZone()));
startCal.setTime(iterStart);
startCal.add(freq.getTimeUnit().getCalendarUnit(), Integer.valueOf((coord.getFrequency())));
@@ -805,18 +812,19 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine {
}
}
- private List<CoordinatorJob> getApplicableCoords(Entity entity, ProxyOozieClient client, Date start, Date end,
- List<BundleJob> bundles) throws FalconException {
-
+ private List<CoordinatorJob> getApplicableCoords(Entity entity, ProxyOozieClient client, Date start,
+ Date end, List<BundleJob> bundles) throws FalconException {
+ String retentionCoordName = EntityUtil.getWorkflowName(Tag.RETENTION, entity).toString();
List<CoordinatorJob> applicableCoords = new ArrayList<CoordinatorJob>();
try {
for (BundleJob bundle : bundles) {
List<CoordinatorJob> coords = client.getBundleJobInfo(bundle.getId()).getCoordinators();
for (CoordinatorJob coord : coords) {
- String coordName = EntityUtil.getWorkflowName(Tag.RETENTION, entity).toString();
- if (coordName.equals(coord.getAppName())) {
+ // ignore coords in PREP state, not yet running and retention coord
+ if (coord.getStatus() == Status.PREP || retentionCoordName.equals(coord.getAppName())) {
continue;
}
+
// if end time is before coord-start time or start time is
// after coord-end time ignore.
if (!(end.compareTo(coord.getStartTime()) <= 0 || start.compareTo(coord.getEndTime()) >= 0)) {