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/06/16 07:43:38 UTC

[1/3] git commit: FALCON-453 possible LICENSE/NOTICE issues - take 2. Contributed by Venkatesh Seetharam

Repository: incubator-falcon
Updated Branches:
  refs/heads/master 448e92bb5 -> e01dd79c7


FALCON-453 possible LICENSE/NOTICE issues - take 2. 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/ab07b44b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/ab07b44b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/ab07b44b

Branch: refs/heads/master
Commit: ab07b44bb76237765e6dc2d8c576d69ac70a59a9
Parents: 448e92b
Author: Venkatesh Seetharam <ve...@apache.org>
Authored: Mon Jun 16 11:01:12 2014 +0530
Committer: Venkatesh Seetharam <ve...@apache.org>
Committed: Mon Jun 16 11:01:12 2014 +0530

----------------------------------------------------------------------
 LICENSE.txt | 42 ------------------------------------------
 NOTICE.txt  |  7 -------
 2 files changed, 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/ab07b44b/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index aa47e50..da4eddc 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -210,45 +210,3 @@ licenses.
 
 
 ================================
-
-For the Bootstrap library:
-
-Version: v3.0.2
-License: https://github.com/twbs/bootstrap/blob/master/LICENSE
-
-The MIT License (MIT)
-
-Copyright (c) 2011-2014 Twitter, Inc
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
-For the GLYPHICONS Halflings in Bootstrap library:
-
-License: http://glyphicons.com/license/
-
-GLYPHICONS Halflings are also a part of Bootstrap from Twitter, and they are
-released under the same license as Bootstrap (The MIT License (MIT)).
-
-While you are not required to include attribution on your Bootstrap-based
-projects, I would certainly appreciate a visible link back to GLYPHICONS.com
-in any place you find appropriate (footer, docs, etc).
-
-
-================================

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/ab07b44b/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
index 4d165ac..05549c0 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -4,10 +4,3 @@ Copyright 2011-2014 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
-
-
-This product includes Bootstrap (http://getbootstrap.com/),
-Copyright (c) 2012 Twitter, Inc.
-
-This product includes Glyphicons Halflings (http://glyphicons.com/)
-as part of Bootstrap from Twitter


[2/3] git commit: FALCON-459 Lineage resource API fails with NPE for bad query params. Contributed by Sowmya Ramesh

Posted by ve...@apache.org.
FALCON-459 Lineage resource API fails with NPE for bad query params. Contributed by Sowmya Ramesh


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

Branch: refs/heads/master
Commit: 662adb2154cbd47bbdaebceae529013ed37d125f
Parents: ab07b44
Author: Venkatesh Seetharam <ve...@apache.org>
Authored: Mon Jun 16 11:11:11 2014 +0530
Committer: Venkatesh Seetharam <ve...@apache.org>
Committed: Mon Jun 16 11:11:11 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../metadata/LineageMetadataResource.java       | 42 ++++++++++++++------
 .../metadata/LineageMetadataResourceTest.java   | 21 ++++++++++
 3 files changed, 54 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/662adb21/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 418d337..b24fc4b 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -16,6 +16,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-459 Lineage resource API fails with NPE for bad query params
+   (Sowmya Ramesh via Venkatesh Seetharam)
+
    FALCON-456 Custom DistCp conflict with core DistCp in container classpath
    fails falcon workflows (Venkatesh Seetharam)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/662adb21/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java b/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
index 93b4c04..cf6b6b1 100644
--- a/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
+++ b/prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java
@@ -38,6 +38,7 @@ import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.commons.lang.StringUtils;
 
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
@@ -143,6 +144,7 @@ public class LineageMetadataResource {
     public Response getVertex(@PathParam("id") final String vertexId) {
         checkIfMetadataMappingServiceIsEnabled();
         LOG.info("Get vertex for vertexId= {}", vertexId);
+        validateInputs("Invalid argument: vertex id passed is null or empty.", vertexId);
         try {
             Vertex vertex = findVertex(vertexId);
 
@@ -182,6 +184,7 @@ public class LineageMetadataResource {
                                         final String relationships) {
         checkIfMetadataMappingServiceIsEnabled();
         LOG.info("Get vertex for vertexId= {}", vertexId);
+        validateInputs("Invalid argument: vertex id passed is null or empty.", vertexId);
         try {
             Vertex vertex = findVertex(vertexId);
 
@@ -281,6 +284,7 @@ public class LineageMetadataResource {
                                 @QueryParam("value") final String value) {
         checkIfMetadataMappingServiceIsEnabled();
         LOG.info("Get vertices for property key= {}, value= {}", key, value);
+        validateInputs("Invalid argument: key or value passed is null or empty.", key, value);
         try {
             JSONObject response = buildJSONResponse(getGraph().getVertices(key, value));
             return Response.ok(response).build();
@@ -305,6 +309,8 @@ public class LineageMetadataResource {
                                    @PathParam("direction") String direction) {
         checkIfMetadataMappingServiceIsEnabled();
         LOG.info("Get vertex edges for vertexId= {}, direction= {}", vertexId, direction);
+        // Validate vertex id. Direction is validated in VertexQueryArguments.
+        validateInputs("Invalid argument: vertex id or direction passed is null or empty.", vertexId, direction);
         try {
             Vertex vertex = findVertex(vertexId);
 
@@ -394,6 +400,7 @@ public class LineageMetadataResource {
     public Response getEdge(@PathParam("id") final String edgeId) {
         checkIfMetadataMappingServiceIsEnabled();
         LOG.info("Get vertex for edgeId= {}", edgeId);
+        validateInputs("Invalid argument: edge id passed is null or empty.", edgeId);
         try {
             Edge edge = getGraph().getEdge(edgeId);
             if (edge == null) {
@@ -439,6 +446,17 @@ public class LineageMetadataResource {
         }
     }
 
+    private static void validateInputs(String errorMsg, String... inputs) {
+        for (String input : inputs) {
+            if (StringUtils.isEmpty(input)) {
+                throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
+                        .entity(errorMsg)
+                        .type("text/plain")
+                        .build());
+            }
+        }
+    }
+
     private enum ReturnType {VERTICES, EDGES, COUNT, VERTEX_IDS}
 
     public static final String OUT_E = "outE";
@@ -464,51 +482,51 @@ public class LineageMetadataResource {
         private final boolean countOnly;
 
         public VertexQueryArguments(String directionSegment) {
-            if (directionSegment.equals(OUT_E)) {
+            if (OUT_E.equals(directionSegment)) {
                 returnType = ReturnType.EDGES;
                 queryDirection = Direction.OUT;
                 countOnly = false;
-            } else if (directionSegment.equals(IN_E)) {
+            } else if (IN_E.equals(directionSegment)) {
                 returnType = ReturnType.EDGES;
                 queryDirection = Direction.IN;
                 countOnly = false;
-            } else if (directionSegment.equals(BOTH_E)) {
+            } else if (BOTH_E.equals(directionSegment)) {
                 returnType = ReturnType.EDGES;
                 queryDirection = Direction.BOTH;
                 countOnly = false;
-            } else if (directionSegment.equals(OUT)) {
+            } else if (OUT.equals(directionSegment)) {
                 returnType = ReturnType.VERTICES;
                 queryDirection = Direction.OUT;
                 countOnly = false;
-            } else if (directionSegment.equals(IN)) {
+            } else if (IN.equals(directionSegment)) {
                 returnType = ReturnType.VERTICES;
                 queryDirection = Direction.IN;
                 countOnly = false;
-            } else if (directionSegment.equals(BOTH)) {
+            } else if (BOTH.equals(directionSegment)) {
                 returnType = ReturnType.VERTICES;
                 queryDirection = Direction.BOTH;
                 countOnly = false;
-            } else if (directionSegment.equals(BOTH_COUNT)) {
+            } else if (BOTH_COUNT.equals(directionSegment)) {
                 returnType = ReturnType.COUNT;
                 queryDirection = Direction.BOTH;
                 countOnly = true;
-            } else if (directionSegment.equals(IN_COUNT)) {
+            } else if (IN_COUNT.equals(directionSegment)) {
                 returnType = ReturnType.COUNT;
                 queryDirection = Direction.IN;
                 countOnly = true;
-            } else if (directionSegment.equals(OUT_COUNT)) {
+            } else if (OUT_COUNT.equals(directionSegment)) {
                 returnType = ReturnType.COUNT;
                 queryDirection = Direction.OUT;
                 countOnly = true;
-            } else if (directionSegment.equals(BOTH_IDS)) {
+            } else if (BOTH_IDS.equals(directionSegment)) {
                 returnType = ReturnType.VERTEX_IDS;
                 queryDirection = Direction.BOTH;
                 countOnly = false;
-            } else if (directionSegment.equals(IN_IDS)) {
+            } else if (IN_IDS.equals(directionSegment)) {
                 returnType = ReturnType.VERTEX_IDS;
                 queryDirection = Direction.IN;
                 countOnly = false;
-            } else if (directionSegment.equals(OUT_IDS)) {
+            } else if (OUT_IDS.equals(directionSegment)) {
                 returnType = ReturnType.VERTEX_IDS;
                 queryDirection = Direction.OUT;
                 countOnly = false;

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/662adb21/prism/src/test/java/org/apache/falcon/resource/metadata/LineageMetadataResourceTest.java
----------------------------------------------------------------------
diff --git a/prism/src/test/java/org/apache/falcon/resource/metadata/LineageMetadataResourceTest.java b/prism/src/test/java/org/apache/falcon/resource/metadata/LineageMetadataResourceTest.java
index e4d06a5..26c24c7 100644
--- a/prism/src/test/java/org/apache/falcon/resource/metadata/LineageMetadataResourceTest.java
+++ b/prism/src/test/java/org/apache/falcon/resource/metadata/LineageMetadataResourceTest.java
@@ -215,6 +215,18 @@ public class LineageMetadataResourceTest {
     }
 
     @Test
+    public void testGetVerticesWithInvalidKeyValue() throws Exception {
+        LineageMetadataResource resource = new LineageMetadataResource();
+        try {
+            resource.getVertices(null, null);
+        } catch(WebApplicationException e) {
+            Assert.assertEquals(e.getResponse().getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
+            Assert.assertEquals(e.getResponse().getEntity().toString(),
+                    "Invalid argument: key or value passed is null or empty.");
+        }
+    }
+
+    @Test
     public void testVertexEdgesForIdAndDirectionOut() throws Exception {
         String processInstance = PROCESS_ENTITY_NAME + "/2014-01-01T01:00Z";
         Vertex vertex = service.getGraph().getVertices(
@@ -265,6 +277,15 @@ public class LineageMetadataResourceTest {
         verifyVertexEdgesCount(vertexId, LineageMetadataResource.BOTH_IDS, expectedSize);
     }
 
+
+
+    @Test (expectedExceptions = WebApplicationException.class)
+    public void testVertexEdgesForIdAndInvalidDirection() throws Exception {
+        LineageMetadataResource resource = new LineageMetadataResource();
+        resource.getVertexEdges("0", "blah");
+        Assert.fail("The API call should have thrown an exception");
+    }
+
     private void verifyVertexEdges(String vertexId, String direction,
                                    int expectedSize, List<String> expected) {
         LineageMetadataResource resource = new LineageMetadataResource();


[3/3] git commit: FALCON-460 Concurrent deletion of same entity results in NPE. Contributed by Sowmya Ramesh

Posted by ve...@apache.org.
FALCON-460 Concurrent deletion of same entity results in NPE. Contributed by Sowmya Ramesh


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

Branch: refs/heads/master
Commit: e01dd79c73fa6bc9623dbdd87e7981eff1796c6c
Parents: 662adb2
Author: Venkatesh Seetharam <ve...@apache.org>
Authored: Mon Jun 16 11:13:21 2014 +0530
Committer: Venkatesh Seetharam <ve...@apache.org>
Committed: Mon Jun 16 11:13:21 2014 +0530

----------------------------------------------------------------------
 CHANGES.txt                                       |  3 +++
 .../falcon/entity/store/ConfigurationStore.java   |  2 +-
 .../entity/store/ConfigurationStoreTest.java      | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e01dd79c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b24fc4b..98b782b 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -16,6 +16,9 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+   FALCON-460 Concurrent deletion of same entity results in NPE (Sowmya Ramesh
+   via Venkatesh Seetharam)
+
    FALCON-459 Lineage resource API fails with NPE for bad query params
    (Sowmya Ramesh via Venkatesh Seetharam)
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e01dd79c/common/src/main/java/org/apache/falcon/entity/store/ConfigurationStore.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/entity/store/ConfigurationStore.java b/common/src/main/java/org/apache/falcon/entity/store/ConfigurationStore.java
index 0534cc4..cb594d1 100644
--- a/common/src/main/java/org/apache/falcon/entity/store/ConfigurationStore.java
+++ b/common/src/main/java/org/apache/falcon/entity/store/ConfigurationStore.java
@@ -275,7 +275,7 @@ public final class ConfigurationStore implements FalconService {
      *         exist
      * @throws FalconException
      */
-    public boolean remove(EntityType type, String name) throws FalconException {
+    public synchronized boolean remove(EntityType type, String name) throws FalconException {
         Map<String, Entity> entityMap = dictionary.get(type);
         if (entityMap.containsKey(name)) {
             try {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/e01dd79c/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java b/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
index 288fdfa..9886d88 100644
--- a/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
+++ b/common/src/test/java/org/apache/falcon/entity/store/ConfigurationStoreTest.java
@@ -98,6 +98,7 @@ public class ConfigurationStoreTest {
         Process process = new Process();
         process.setName("remove");
         store.publish(EntityType.PROCESS, process);
+
         Process p = store.get(EntityType.PROCESS, "remove");
         Assert.assertEquals(p, process);
         store.remove(EntityType.PROCESS, "remove");
@@ -115,6 +116,23 @@ public class ConfigurationStoreTest {
         store.unregisterListener(listener);
     }
 
+
+    @Test(threadPoolSize = 3, invocationCount = 6)
+    public void testConcurrentRemoves() throws Exception {
+        Process process = new Process();
+        process.setName("remove");
+        try {
+            store.publish(EntityType.PROCESS, process);
+        } catch(EntityAlreadyExistsException e) {
+            // Ignore this
+        }
+        Process p = store.get(EntityType.PROCESS, "remove");
+        Assert.assertEquals(p, process);
+        store.remove(EntityType.PROCESS, "remove");
+        p = store.get(EntityType.PROCESS, "remove");
+        Assert.assertNull(p);
+    }
+
     @BeforeSuite
     @AfterSuite
     public void cleanup() throws IOException {