mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Part of ALF-10699: Nodes not getting put into new transactions during various operations
- Mass ACL updates of primary children now update the version and transaction for the affected nodes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31108 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -184,7 +184,7 @@ Inbound settings from iBatis
|
|||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/content-insert-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/content-insert-SqlMap.xml"/>
|
||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-common-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/node-common-SqlMap.xml"/>
|
||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-select-children-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/node-select-children-SqlMap.xml"/>
|
||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-update-acl-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/node-update-SqlMap.xml"/>
|
||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-insert-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/node-insert-SqlMap.xml"/>
|
||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/patch-common-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/patch-common-SqlMap.xml"/>
|
||||||
<mapper resource="alfresco/ibatis/#resource.dialect#/permissions-common-SqlMap.xml"/>
|
<mapper resource="alfresco/ibatis/#resource.dialect#/permissions-common-SqlMap.xml"/>
|
||||||
|
@@ -11,7 +11,9 @@
|
|||||||
update
|
update
|
||||||
alf_node
|
alf_node
|
||||||
set
|
set
|
||||||
acl_id = #{newSharedAclId}
|
acl_id = #{newSharedAclId},
|
||||||
|
version = version + 1,
|
||||||
|
transaction_id = #{txnId}
|
||||||
where id in
|
where id in
|
||||||
(
|
(
|
||||||
select n.id
|
select n.id
|
||||||
@@ -27,5 +29,26 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Use ANSI subselect. This is not performant on MySQL.
|
||||||
|
-->
|
||||||
|
<update id="update_ChildrenTxns" parameterType="ChildAssoc">
|
||||||
|
update
|
||||||
|
alf_node
|
||||||
|
set
|
||||||
|
version = version + 1,
|
||||||
|
n.transaction_id = #{parent.transaction.id}
|
||||||
|
where id in
|
||||||
|
(
|
||||||
|
select
|
||||||
|
ca.child_node_id
|
||||||
|
from
|
||||||
|
alf_child_assoc ca
|
||||||
|
where
|
||||||
|
ca.parent_node_id = #{parent.id}
|
||||||
|
<if test="isPrimary == true">and ca.is_primary = #{isPrimary}</if>
|
||||||
|
)
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@@ -12,7 +12,9 @@
|
|||||||
alf_child_assoc assoc
|
alf_child_assoc assoc
|
||||||
join alf_node child on (child.id = assoc.child_node_id and assoc.is_primary = #{isPrimary})
|
join alf_node child on (child.id = assoc.child_node_id and assoc.is_primary = #{isPrimary})
|
||||||
set
|
set
|
||||||
child.acl_id = #{newSharedAclId}
|
child.acl_id = #{newSharedAclId},
|
||||||
|
child.version = child.version + 1,
|
||||||
|
child.transaction_id = #{txnId}
|
||||||
where
|
where
|
||||||
assoc.parent_node_id = #{primaryParentNodeId}
|
assoc.parent_node_id = #{primaryParentNodeId}
|
||||||
and
|
and
|
||||||
@@ -21,5 +23,20 @@
|
|||||||
<if test="optionalOldSharedAclIdInAdditionToNull != null"> OR child.acl_id = #{optionalOldSharedAclIdInAdditionToNull}</if>
|
<if test="optionalOldSharedAclIdInAdditionToNull != null"> OR child.acl_id = #{optionalOldSharedAclIdInAdditionToNull}</if>
|
||||||
)
|
)
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
ANSI subselect is not performant on MySQL. Use non-ANSI join syntax.
|
||||||
|
-->
|
||||||
|
<update id="update_ChildrenTxns" parameterType="ChildAssoc">
|
||||||
|
update
|
||||||
|
alf_node n
|
||||||
|
join alf_child_assoc ca on (ca.child_node_id = n.id)
|
||||||
|
set
|
||||||
|
n.version = n.version + 1,
|
||||||
|
n.transaction_id = #{parentNode.transaction.id}
|
||||||
|
where
|
||||||
|
ca.parent_node_id = #{parentNode.id}
|
||||||
|
<if test="isPrimary == true">and ca.is_primary = #{isPrimary}</if>
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@@ -1565,7 +1565,12 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
Long optionalOldSharedAlcIdInAdditionToNull,
|
Long optionalOldSharedAlcIdInAdditionToNull,
|
||||||
Long newSharedAclId)
|
Long newSharedAclId)
|
||||||
{
|
{
|
||||||
updatePrimaryChildrenSharedAclId(primaryParentNodeId, optionalOldSharedAlcIdInAdditionToNull, newSharedAclId);
|
Long txnId = getCurrentTransactionId();
|
||||||
|
updatePrimaryChildrenSharedAclId(
|
||||||
|
txnId,
|
||||||
|
primaryParentNodeId,
|
||||||
|
optionalOldSharedAlcIdInAdditionToNull,
|
||||||
|
newSharedAclId);
|
||||||
invalidateCachesByNodeId(primaryParentNodeId, null, nodesCache);
|
invalidateCachesByNodeId(primaryParentNodeId, null, nodesCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3362,12 +3367,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
throw new DataIntegrityViolationException("Stale cache detected for Node #" + nodeId);
|
throw new DataIntegrityViolationException("Stale cache detected for Node #" + nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParentAssocsInfo getParentAssocsCacheOnly(Long nodeId)
|
|
||||||
{
|
|
||||||
// can be null
|
|
||||||
return parentAssocsCache.getValue(nodeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a node's parent associations.
|
* Update a node's parent associations.
|
||||||
*/
|
*/
|
||||||
@@ -3848,6 +3847,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
protected abstract int updateNode(NodeUpdateEntity nodeUpdate);
|
protected abstract int updateNode(NodeUpdateEntity nodeUpdate);
|
||||||
protected abstract int updateNodePatchAcl(NodeUpdateEntity nodeUpdate);
|
protected abstract int updateNodePatchAcl(NodeUpdateEntity nodeUpdate);
|
||||||
protected abstract void updatePrimaryChildrenSharedAclId(
|
protected abstract void updatePrimaryChildrenSharedAclId(
|
||||||
|
Long txnId,
|
||||||
Long primaryParentNodeId,
|
Long primaryParentNodeId,
|
||||||
Long optionalOldSharedAlcIdInAdditionToNull,
|
Long optionalOldSharedAlcIdInAdditionToNull,
|
||||||
Long newSharedAlcId);
|
Long newSharedAlcId);
|
||||||
|
@@ -27,6 +27,7 @@ package org.alfresco.repo.domain.node;
|
|||||||
*/
|
*/
|
||||||
public class PrimaryChildrenAclUpdateEntity
|
public class PrimaryChildrenAclUpdateEntity
|
||||||
{
|
{
|
||||||
|
Long txnId;
|
||||||
Long primaryParentNodeId;
|
Long primaryParentNodeId;
|
||||||
Long optionalOldSharedAclIdInAdditionToNull;
|
Long optionalOldSharedAclIdInAdditionToNull;
|
||||||
Long newSharedAclId;
|
Long newSharedAclId;
|
||||||
@@ -35,6 +36,16 @@ public class PrimaryChildrenAclUpdateEntity
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getTxnId()
|
||||||
|
{
|
||||||
|
return txnId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxnId(Long txnId)
|
||||||
|
{
|
||||||
|
this.txnId = txnId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getPrimaryParentNodeId()
|
public Long getPrimaryParentNodeId()
|
||||||
{
|
{
|
||||||
return primaryParentNodeId;
|
return primaryParentNodeId;
|
||||||
|
@@ -326,11 +326,13 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updatePrimaryChildrenSharedAclId(
|
protected void updatePrimaryChildrenSharedAclId(
|
||||||
|
Long txnId,
|
||||||
Long primaryParentNodeId,
|
Long primaryParentNodeId,
|
||||||
Long optionalOldSharedAlcIdInAdditionToNull,
|
Long optionalOldSharedAlcIdInAdditionToNull,
|
||||||
Long newSharedAlcId)
|
Long newSharedAlcId)
|
||||||
{
|
{
|
||||||
PrimaryChildrenAclUpdateEntity primaryChildrenAclUpdateEntity = new PrimaryChildrenAclUpdateEntity();
|
PrimaryChildrenAclUpdateEntity primaryChildrenAclUpdateEntity = new PrimaryChildrenAclUpdateEntity();
|
||||||
|
primaryChildrenAclUpdateEntity.setTxnId(txnId);
|
||||||
primaryChildrenAclUpdateEntity.setPrimaryParentNodeId(primaryParentNodeId);
|
primaryChildrenAclUpdateEntity.setPrimaryParentNodeId(primaryParentNodeId);
|
||||||
primaryChildrenAclUpdateEntity.setOptionalOldSharedAclIdInAdditionToNull(optionalOldSharedAlcIdInAdditionToNull);
|
primaryChildrenAclUpdateEntity.setOptionalOldSharedAclIdInAdditionToNull(optionalOldSharedAlcIdInAdditionToNull);
|
||||||
primaryChildrenAclUpdateEntity.setNewSharedAclId(newSharedAlcId);
|
primaryChildrenAclUpdateEntity.setNewSharedAclId(newSharedAlcId);
|
||||||
|
Reference in New Issue
Block a user