Reversed out revision 31446

- Offending change is: "Touch node and copy node caches *before* writing updated cache entry"
 - Struggling to find a fix for the recent test failures that includes this code
 - This code (or equivalent) will go onto a branch for further investigation


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31543 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-10-28 13:46:37 +00:00
parent da544dd1e7
commit aed94742c3
3 changed files with 279 additions and 166 deletions

View File

@@ -1606,16 +1606,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
}
// The node is remaining in the current store
int count = 0;
Throwable concurrencyException = null;
try
{
count = updateNode(nodeUpdate);
}
catch (Throwable e)
{
concurrencyException = e;
}
int count = updateNode(nodeUpdate);
// Do concurrency check
if (count != 1)
{
@@ -1623,7 +1614,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
nodesCache.removeByKey(nodeId);
nodesCache.removeByValue(nodeUpdate);
throw new ConcurrencyFailureException("Failed to update node " + nodeId, concurrencyException);
throw new ConcurrencyFailureException("Failed to update node " + nodeId);
}
else
{
@@ -1631,6 +1622,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
nodeUpdate.lock();
nodesCache.setValue(nodeId, nodeUpdate);
// The node's version has moved on so no need to invalidate caches
// TODO: Should we copy values between the cache keys?
}
// Done
@@ -1977,18 +1969,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
boolean modifyProps = propsToDelete.size() > 0 || propsToAdd.size() > 0;
boolean updated = modifyProps || nodeUpdate.isUpdateAnything();
// Now we know that the node needs modification or not; grab the lock
if (nodeUpdate.isUpdateAnything())
{
// We have to explicitly update the node (sys:locale or cm:auditable)
updateNodeImpl(node, nodeUpdate);
}
else if (modifyProps)
{
// Touch the node; all caches are fine
touchNode(nodeId, null, false, false, false);
}
// Touch to bring into current txn
if (modifyProps)
{
// Clean up content properties
@@ -2051,6 +2032,12 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
// Update cache
setNodePropertiesCached(nodeId, propsToCache);
}
// Touch to bring into current transaction
if (updated)
{
// We have to explicitly update the node (sys:locale or cm:auditable)
updateNodeImpl(node, nodeUpdate);
}
// Done
if (isDebugEnabled && updated)
@@ -2112,12 +2099,12 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
if (deleteCount > 0)
{
// Touch the node; all caches are fine
touchNode(nodeId, null, false, false, false);
// Update cache
Map<QName, Serializable> cachedProps = getNodePropertiesCached(nodeId);
cachedProps.keySet().removeAll(propertyQNames);
setNodePropertiesCached(nodeId, cachedProps);
// Touch the node; all caches are fine
touchNode(nodeId, null, false, false, false);
}
// Done
return deleteCount > 0;
@@ -2346,7 +2333,11 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
executeBatch();
}
// Bring the node into the transaction
// Manually update the cache
Set<QName> newAspectQNames = new HashSet<QName>(existingAspectQNames);
newAspectQNames.addAll(aspectQNamesToAdd);
setNodeAspectsCached(nodeId, newAspectQNames);
if (aspectQNamesToAdd.contains(ContentModel.ASPECT_ROOT))
{
// This is a special case. The presence of the aspect affects the path
@@ -2358,11 +2349,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
// Touch the node; all caches are fine
touchNode(nodeId, null, false, false, false);
}
// Manually update the cache
Set<QName> newAspectQNames = new HashSet<QName>(existingAspectQNames);
newAspectQNames.addAll(aspectQNamesToAdd);
setNodeAspectsCached(nodeId, newAspectQNames);
// Done
return true;
@@ -2760,6 +2746,13 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
// Persist it
assoc.setId(assocId);
// Primary associations accompany new nodes, so we only have to bring the
// node into the current transaction for secondary associations
if (!isPrimary)
{
updateNode(childNodeId, null, null);
}
// Done
if (isDebugEnabled)
{