Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

92720: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud)
      92677: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1)
         92592: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.5)
            92521: Fix MNT-13032: Poor query plan for select_ChildNodeIds_Limited
             - Pull query out into a general snippet
             - Changed paging to use alf_child_assoc.child_node_id
             - Changed query sort to use child_node_id
             - No more 'filesort'


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94906 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 11:56:43 +00:00
parent 995242397c
commit 8215994da0
5 changed files with 33 additions and 41 deletions

View File

@@ -519,29 +519,28 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
int count = 0;
List<Long> childNodeIds = new ArrayList<Long>(256);
Long minAssocIdInclusive = Long.MIN_VALUE;
while (minAssocIdInclusive != null)
Long minChildNodeIdInclusive = Long.MIN_VALUE;
while (minChildNodeIdInclusive != null)
{
childNodeIds.clear();
List<ChildAssocEntity> childAssocs = selectChildNodeIds(
parentNodeId,
Boolean.valueOf(primary),
minAssocIdInclusive,
minChildNodeIdInclusive,
256);
// Remove the cache entries as we go
for (ChildAssocEntity childAssoc : childAssocs)
{
Long childAssocId = childAssoc.getId();
if (childAssocId.compareTo(minAssocIdInclusive) < 0)
Long childNodeId = childAssoc.getChildNode().getId();
if (childNodeId.compareTo(minChildNodeIdInclusive) < 0)
{
throw new RuntimeException("Query results did not increase for assoc ID");
throw new RuntimeException("Query results did not increase for child node id ID");
}
else
{
minAssocIdInclusive = new Long(childAssocId.longValue() + 1L);
minChildNodeIdInclusive = new Long(childNodeId.longValue() + 1L);
}
// Invalidate the node cache
Long childNodeId = childAssoc.getChildNode().getId();
childNodeIds.add(childNodeId);
invalidateNodeCaches(childNodeId);
count++;