Repository: falcon Updated Branches: refs/heads/master 057440ad9 -> 7a1ef4d27
FALCON-1331 Update Failed for an entity and further updates are not possible as lock is not released. Contributed by Pavan Kumar Kolamuri. Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/7a1ef4d2 Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/7a1ef4d2 Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/7a1ef4d2 Branch: refs/heads/master Commit: 7a1ef4d27ca49718bfb39c7b0d38fc1b719fbc8e Parents: 057440a Author: Ajay Yadava <[email protected]> Authored: Fri Sep 18 18:12:09 2015 +0530 Committer: Ajay Yadava <[email protected]> Committed: Fri Sep 18 18:12:09 2015 +0530 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../falcon/resource/AbstractEntityManager.java | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/7a1ef4d2/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 7520ba6..61665e8 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -28,6 +28,8 @@ Trunk (Unreleased) FALCON-1403 Revisit IT cleanup and teardown(Narayan Periwal via Pallavi Rao) BUG FIXES + FALCON-1331 Update Failed for an entity and further updates are not possible as lock is not released(Pavan Kumar Kolamuri via Ajay Yadava) + FALCON-1408 Add more logging information for failing ClusterEntityValidationIT(Pavan Kumar Kolamuri via Ajay Yadava) FALCON-1442 Contract of WorkflowEngine API broken(Balu Vellanki via Ajay Yadava) http://git-wip-us.apache.org/repos/asf/falcon/blob/7a1ef4d2/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java ---------------------------------------------------------------------- diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java index bed0b6c..2682257 100644 --- a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java +++ b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java @@ -245,7 +245,7 @@ public abstract class AbstractEntityManager { */ public APIResult delete(HttpServletRequest request, String type, String entity, String colo) { checkColo(colo); - List<Entity> tokenList = null; + List<Entity> tokenList = new ArrayList<>(); try { EntityType entityType = EntityType.getEnum(type); String removedFromEngine = ""; @@ -253,7 +253,7 @@ public abstract class AbstractEntityManager { Entity entityObj = EntityUtil.getEntity(type, entity); canRemove(entityObj); - tokenList = obtainEntityLocks(entityObj, "delete"); + obtainEntityLocks(entityObj, "delete", tokenList); if (entityType.isSchedulable() && !DeploymentUtil.isPrism()) { getWorkflowEngine().delete(entityObj); removedFromEngine = "(KILLED in ENGINE)"; @@ -278,7 +278,7 @@ public abstract class AbstractEntityManager { public APIResult update(HttpServletRequest request, String type, String entityName, String colo, Boolean skipDryRun) { checkColo(colo); - List<Entity> tokenList = null; + List<Entity> tokenList = new ArrayList<>(); try { EntityType entityType = EntityType.getEnum(type); Entity oldEntity = EntityUtil.getEntity(type, entityName); @@ -290,7 +290,7 @@ public abstract class AbstractEntityManager { validateUpdate(oldEntity, newEntity); configStore.initiateUpdate(newEntity); - tokenList = obtainEntityLocks(oldEntity, "update"); + obtainEntityLocks(oldEntity, "update", tokenList); StringBuilder result = new StringBuilder("Updated successfully"); //Update in workflow engine @@ -320,10 +320,11 @@ public abstract class AbstractEntityManager { } } - private List<Entity> obtainEntityLocks(Entity entity, String command) + private void obtainEntityLocks(Entity entity, String command, List<Entity> tokenList) throws FalconException { - List<Entity> tokenList = new ArrayList<Entity>(); - + if (tokenList == null) { + tokenList = new ArrayList<>(); + } //first obtain lock for the entity for which update is issued. if (memoryLocks.acquireLock(entity)) { tokenList.add(entity); @@ -346,7 +347,6 @@ public abstract class AbstractEntityManager { } } } - return tokenList; } private void releaseEntityLocks(String entityName, List<Entity> tokenList) { @@ -404,12 +404,12 @@ public abstract class AbstractEntityManager { EntityType entityType = EntityType.getEnum(type); Entity entity = deserializeEntity(request, entityType); - List<Entity> tokenList = null; + List<Entity> tokenList = new ArrayList<>(); // KLUDGE - Until ACL is mandated entity passed should be decorated for equals check to pass decorateEntityWithACL(entity); try { - tokenList = obtainEntityLocks(entity, "submit"); + obtainEntityLocks(entity, "submit", tokenList); }finally { ConfigurationStore.get().cleanupUpdateInit(); releaseEntityLocks(entity.getName(), tokenList);
