Repository: oozie Updated Branches: refs/heads/master be293c046 -> 660b3151c
OOZIE-3079 Filtering coordinators returns bundle id as null (satishsaley) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/660b3151 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/660b3151 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/660b3151 Branch: refs/heads/master Commit: 660b3151ce1b808e922d708f14b460a715fa6a33 Parents: be293c0 Author: satishsaley <[email protected]> Authored: Mon Oct 9 09:57:37 2017 -0700 Committer: satishsaley <[email protected]> Committed: Mon Oct 9 09:57:37 2017 -0700 ---------------------------------------------------------------------- .../org/apache/oozie/CoordinatorJobBean.java | 5 ++++- .../executor/jpa/CoordJobInfoGetJPAExecutor.java | 3 +++ .../apache/oozie/store/StoreStatusFilter.java | 2 +- .../jpa/TestCoordJobInfoGetJPAExecutor.java | 19 +++++++++++++++++++ release-log.txt | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/660b3151/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java b/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java index 3a3120d..7dda508 100644 --- a/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java +++ b/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java @@ -108,7 +108,10 @@ import org.json.simple.JSONObject; @NamedQuery(name = "GET_COORD_JOBS_COUNT", query = "select count(w) from CoordinatorJobBean w"), - @NamedQuery(name = "GET_COORD_JOBS_COLUMNS", query = "select w.id, w.appName, w.statusStr, w.user, w.group, w.startTimestamp, w.endTimestamp, w.appPath, w.concurrency, w.frequency, w.lastActionTimestamp, w.nextMaterializedTimestamp, w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut from CoordinatorJobBean w order by w.createdTimestamp desc"), + @NamedQuery(name = "GET_COORD_JOBS_COLUMNS", query = "select w.id, w.appName, w.statusStr, w.user, w.group, " + + "w.startTimestamp, w.endTimestamp, w.appPath, w.concurrency, w.frequency, w.lastActionTimestamp, " + + "w.nextMaterializedTimestamp, w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut, w.bundleId " + + "from CoordinatorJobBean w order by w.createdTimestamp desc"), //TODO need to remove. @NamedQuery(name = "GET_COORD_JOBS_OLDER_THAN", query = "select OBJECT(w) from CoordinatorJobBean w where w.startTimestamp <= :matTime AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' or w.statusStr = 'RUNNINGWITHERROR') AND (w.nextMaterializedTimestamp < :matTime OR w.nextMaterializedTimestamp IS NULL) AND (w.nextMaterializedTimestamp IS NULL OR (w.endTimestamp > w.nextMaterializedTimestamp AND (w.pauseTimestamp IS NULL OR w.pauseTimestamp > w.nextMaterializedTimestamp))) order by w.lastModifiedTimestamp"), http://git-wip-us.apache.org/repos/asf/oozie/blob/660b3151/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobInfoGetJPAExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobInfoGetJPAExecutor.java b/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobInfoGetJPAExecutor.java index 8ae070e..4c641d7 100644 --- a/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobInfoGetJPAExecutor.java +++ b/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobInfoGetJPAExecutor.java @@ -168,6 +168,9 @@ public class CoordJobInfoGetJPAExecutor implements JPAExecutor<CoordinatorJobInf if (arr[15] != null) { bean.setTimeout((Integer) arr[15]); } + if (arr[16] != null) { + bean.setBundleId((String) arr[16]); + } return bean; } } http://git-wip-us.apache.org/repos/asf/oozie/blob/660b3151/core/src/main/java/org/apache/oozie/store/StoreStatusFilter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/store/StoreStatusFilter.java b/core/src/main/java/org/apache/oozie/store/StoreStatusFilter.java index 0850b75..cba75df 100644 --- a/core/src/main/java/org/apache/oozie/store/StoreStatusFilter.java +++ b/core/src/main/java/org/apache/oozie/store/StoreStatusFilter.java @@ -32,7 +32,7 @@ import org.apache.oozie.util.XLog; public class StoreStatusFilter { public static final String coordSeletStr = "Select w.id, w.appName, w.statusStr, w.user, w.group, w.startTimestamp, " + "w.endTimestamp, w.appPath, w.concurrency, w.frequency, w.lastActionTimestamp, w.nextMaterializedTimestamp, " + - "w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut from CoordinatorJobBean w"; + "w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut, w.bundleId from CoordinatorJobBean w"; public static final String coordCountStr = "Select count(w) from CoordinatorJobBean w"; http://git-wip-us.apache.org/repos/asf/oozie/blob/660b3151/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobInfoGetJPAExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobInfoGetJPAExecutor.java b/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobInfoGetJPAExecutor.java index 43334f9..975bf3e 100644 --- a/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobInfoGetJPAExecutor.java +++ b/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobInfoGetJPAExecutor.java @@ -452,6 +452,25 @@ public class TestCoordJobInfoGetJPAExecutor extends XDataTestCase { compareCoordJobs(coordinatorJob1, ret.getCoordJobs().get(0)); } + public void testGetJobInfoForBundleId() throws Exception { + String bundleId = "0000000-171003192756908-oozie-test-B"; + String coordId = "0000000-171003192756999-oozie-test-C"; + addRecordToCoordJobTableWithBundle(bundleId, coordId, CoordinatorJob.Status.SUCCEEDED, true, true, 1); + + JPAService jpaService = Services.get().get(JPAService.class); + assertNotNull(jpaService); + Map<String, List<String>> filter = new HashMap<String, List<String>>(); + List<String> jobIdList = new ArrayList<String>(); + jobIdList.add(coordId); + filter.put(OozieClient.FILTER_ID, jobIdList); + + CoordJobInfoGetJPAExecutor coordInfoGetCmd = new CoordJobInfoGetJPAExecutor(filter, 1, 20); + CoordinatorJobInfo ret = jpaService.execute(coordInfoGetCmd); + assertNotNull("CoordinatorJobInfo should not be null", ret); + assertEquals("The number of coord jobs should be 1", 1, ret.getCoordJobs().size()); + assertEquals("Failed to verify bundle id of coord job", bundleId, ret.getCoordJobs().get(0).getBundleId()); + } + private void compareCoordJobs(CoordinatorJobBean coordBean, CoordinatorJobBean retCoordBean) { assertEquals(coordBean.getId(), retCoordBean.getId()); assertEquals(coordBean.getStatusStr(), retCoordBean.getStatusStr()); http://git-wip-us.apache.org/repos/asf/oozie/blob/660b3151/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 13d3a97..3358149 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 5.0.0 release (trunk - unreleased) +OOZIE-3079 Filtering coordinators returns bundle id as null (satishsaley) OOZIE-3078 PasswordMasker throws NPE with null arguments (asasvari) OOZIE-3075 Follow-up on OOZIE-3054: create the lib directory if it doesn't exist (pbacsko) OOZIE-3072 oozie.service.HadoopAccessorService.action.configurations should overwrite default values set in Hadoop's configuration files (gezapeti)
