From c4c2ea52e9c09e3c0a1dec678413d3d377b20462 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Sun, 27 Nov 2011 09:29:31 +0000 Subject: [PATCH] Fix ALF-11734: Concurrency conditions not handled correctly for ACL persistence - Struggled to get reproducible test in code - If this doesn't fix the problem fully, then at least it'll push it up a level, however the higher caches already have pessimistic removal of entries, so should be OK - In the same way, this could fix ALF-11720: WCM: OrphanReaper contention throws error (3.4.x) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32329 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/domain/permissions/AbstractAclCrudDAOImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/java/org/alfresco/repo/domain/permissions/AbstractAclCrudDAOImpl.java b/source/java/org/alfresco/repo/domain/permissions/AbstractAclCrudDAOImpl.java index 93bd9d8dbc..35822aac7d 100644 --- a/source/java/org/alfresco/repo/domain/permissions/AbstractAclCrudDAOImpl.java +++ b/source/java/org/alfresco/repo/domain/permissions/AbstractAclCrudDAOImpl.java @@ -258,6 +258,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int updated = aclEntityCache.updateValue(entity.getId(), entity); if (updated < 1) { + aclEntityCache.removeByKey(entity.getId()); throw new ConcurrencyFailureException("AclEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently"); } } @@ -273,6 +274,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int deleted = aclEntityCache.deleteByKey(id); if (deleted < 1) { + aclEntityCache.removeByKey(id); throw new ConcurrencyFailureException("AclEntity with ID " + id + " no longer exists"); } } @@ -432,6 +434,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO if (updated < 1) { + aclEntityCache.removeByKey(entity.getId()); throw new ConcurrencyFailureException("AclMemberEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently"); } } @@ -514,6 +517,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int deleted = deleteAclChangeSetEntity(changeSetId); if (deleted != 1) { + aclEntityCache.removeByKey(changeSetId); throw new ConcurrencyFailureException("Deleted by ID should delete exactly 1: " + changeSetId); } } @@ -738,6 +742,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int updated = permissionEntityCache.updateValue(permission.getId(), permission); if (updated < 1) { + aclEntityCache.removeByKey(permission.getId()); throw new ConcurrencyFailureException("PermissionEntity with ID (" + permission.getId() + ") no longer exists or has been updated concurrently"); } } @@ -754,6 +759,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int deleted = permissionEntityCache.deleteByKey(id); if (deleted < 1) { + aclEntityCache.removeByKey(id); throw new ConcurrencyFailureException("PermissionEntity with ID " + id + " no longer exists"); } } @@ -915,6 +921,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int updated = authorityEntityCache.updateValue(entity.getId(), entity); if (updated < 1) { + aclEntityCache.removeByKey(entity.getId()); throw new ConcurrencyFailureException("AuthorityEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently"); } } @@ -931,6 +938,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO int deleted = authorityEntityCache.deleteByKey(id); if (deleted < 1) { + aclEntityCache.removeByKey(id); throw new ConcurrencyFailureException("AuthorityEntity with ID " + id + " no longer exists"); } }