You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by sa...@apache.org on 2018/01/07 20:53:56 UTC

[3/8] oozie git commit: OOZIE-3079 Filtering coordinators returns bundle id as null (satishsaley)

OOZIE-3079 Filtering coordinators returns bundle id as null (satishsaley)

(cherry picked from commit 660b3151ce1b808e922d708f14b460a715fa6a33)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/7234eee5
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/7234eee5
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/7234eee5

Branch: refs/heads/branch-4.3
Commit: 7234eee586731360519b32f4c624b0b540b5a14e
Parents: f409c2d
Author: satishsaley <sa...@apache.org>
Authored: Mon Oct 9 09:57:37 2017 -0700
Committer: satishsaley <sa...@apache.org>
Committed: Sat Jan 6 11:44:06 2018 -0800

----------------------------------------------------------------------
 .../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/7234eee5/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/7234eee5/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/7234eee5/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 fb1db29..556e708 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/7234eee5/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 7d468f1..ce91da6 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
@@ -340,6 +340,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/7234eee5/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index c682dfa..95b8415 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.1 release
 
+OOZIE-3079 Filtering coordinators returns bundle id as null (satishsaley)
 OOZIE-3078 PasswordMasker throws NPE with null arguments (asasvari)
 OOZIE-3127 Remove redundant check for user (satishsaley)
 OOZIE-2885 Running Spark actions should not need Hive on the classpath (satishsaley)