falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat...@apache.org
Subject [2/3] git commit: FALCON-650 Instance list APIs occassionally fail when orderBy set to starttime or endtime. Contributed by Balu Vellanki
Date Tue, 02 Sep 2014 20:43:14 GMT
FALCON-650 Instance list APIs occassionally fail when orderBy set to starttime or endtime.
Contributed by Balu Vellanki


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/7cfa00db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/7cfa00db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/7cfa00db

Branch: refs/heads/master
Commit: 7cfa00dbdffff166e37b9fc15c633356d1b30f8f
Parents: 8f30ae0
Author: Venkatesh Seetharam <venkatesh@apache.org>
Authored: Tue Sep 2 13:11:41 2014 -0700
Committer: Venkatesh Seetharam <venkatesh@apache.org>
Committed: Tue Sep 2 13:11:41 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                  | 3 +++
 .../org/apache/falcon/resource/AbstractInstanceManager.java  | 8 ++++++--
 webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java  | 5 +++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7cfa00db/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 45f0ac3..085fa8e 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -72,6 +72,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-650 Instance list APIs occassionally fail when orderBy set to
+   starttime or endtime (Balu Vellanki via Venkatesh Seetharam)
+
    FALCON-649 Remove unnecessary validation for Instance start time in
    FalconCLI (Balu Vellanki via Venkatesh Seetharam)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7cfa00db/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
index 1ffe471..e2c465a 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -281,14 +281,18 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
             Collections.sort(instanceSet, new Comparator<Instance>() {
                 @Override
                 public int compare(Instance i1, Instance i2) {
-                    return i2.getStartTime().compareTo(i1.getStartTime()); //default desc
+                    Date start1 = (i1.getStartTime() == null) ? new Date(0) : i1.getStartTime();
+                    Date start2 = (i2.getStartTime() == null) ? new Date(0) : i2.getStartTime();
+                    return start2.compareTo(start1); //default desc
                 }
             });
         } else if (orderBy.equals("endTime")) {
             Collections.sort(instanceSet, new Comparator<Instance>() {
                 @Override
                 public int compare(Instance i1, Instance i2) {
-                    return i2.getEndTime().compareTo(i1.getEndTime()); //default desc
+                    Date end1 = (i1.getEndTime() == null) ? new Date(0) : i1.getEndTime();
+                    Date end2 = (i2.getEndTime() == null) ? new Date(0) : i2.getEndTime();
+                    return end2.compareTo(end1); //default desc
                 }
             });
         }//Default : no sort

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/7cfa00db/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java b/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
index df99c23..1612abb 100644
--- a/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
+++ b/webapp/src/test/java/org/apache/falcon/cli/FalconCLIIT.java
@@ -813,6 +813,11 @@ public class FalconCLIIT {
                 executeWithURL("instance -logs -type process -name "
                         + overlay.get("processName")
                         + " -start " + START_INSTANCE + " -end " + START_INSTANCE
+                        + " -filterBy STATUS:WAITING -orderBy startTime -offset 0 -numResults
1"));
+        Assert.assertEquals(0,
+                executeWithURL("instance -logs -type process -name "
+                        + overlay.get("processName")
+                        + " -start " + START_INSTANCE + " -end " + START_INSTANCE
                         + " -filterBy STATUS:SUCCEEDED,STARTEDAFTER:"+START_INSTANCE+" -offset
1 -numResults 1"));
         Assert.assertEquals(-1,
                 executeWithURL("instance -logs -type process -name "


Mime
View raw message