falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat...@apache.org
Subject [3/3] git commit: FALCON-460 Concurrent deletion of same entity results in NPE. Contributed by Sowmya Ramesh
Date Mon, 16 Jun 2014 05:43:40 GMT
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 <venkatesh@apache.org>
Authored: Mon Jun 16 11:13:21 2014 +0530
Committer: Venkatesh Seetharam <venkatesh@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 {


Mime
View raw message