From 3584a3249ad1726fe19cc8166bd0146d44c7c32a Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Tue, 11 Feb 2014 20:28:17 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud) 57242: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 57222: Reverse Merge in attempt to work out which commit causes the two EmbeddedSolrTest test failures in https://bamboo.alfresco.com/bamboo/browse/ALF-ENTERPRISEV42BUGFIX-23 << was not this one >> 57116: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1) 56986: MNT-9829: Merged V4.1.5 (4.1.5.10) to V4.1-BUG-FIX (4.1.7) 56818: Fix for MNT-9706 Big amount of alf_acl_change_set entries slowing down massively index times and prevent access to report / summary pages of SOLR 56848: Fix for MNT-9706 Big amount of alf_acl_change_set entries slowing down massively index times and prevent access to report / summary pages of SOLR - moved to join, count and group by as having is causing issues. 56868: Fix for MNT-9706 Big amount of alf_acl_change_set entries slowing down massively index times and prevent access to report / summary pages of SOLR - also protect direct acl fetch with node exists test - fix test to use a sensible loop ..... git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61797 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../solr-common-SqlMap.xml | 35 +++++++++++++------ .../repo/solr/SOLRTrackingComponentTest.java | 16 +++++---- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml index d07dbdffe5..7fdc124001 100644 --- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml +++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml @@ -36,10 +36,15 @@ select acs.id as id, acs.commit_time_ms as commit_time_ms, - count(acl_id) as acl_count + (select + count(acl.id) + from + alf_access_control_list acl + where + acl.acl_change_set = acs.id + ) as acl_count from alf_acl_change_set acs - join alf_access_control_list acl on (acl.acl_change_set = acs.id and exists (select 1 from alf_node admnode where admnode.acl_id = acl.id)) = #{fromCommitTimeInclusive}]]> @@ -54,7 +59,6 @@ and - group by acs.commit_time_ms, acs.id order by acs.commit_time_ms ASC, acs.id ASC @@ -65,9 +69,8 @@ from alf_access_control_list acl - exists (select 1 from alf_node admnode where admnode.acl_id = acl.id) - and = #{fromIdInclusive}]]> + = #{fromIdInclusive}]]> and acl.acl_change_set in @@ -81,14 +84,27 @@ diff --git a/source/test-java/org/alfresco/repo/solr/SOLRTrackingComponentTest.java b/source/test-java/org/alfresco/repo/solr/SOLRTrackingComponentTest.java index e59cd2466d..bd9598c73f 100644 --- a/source/test-java/org/alfresco/repo/solr/SOLRTrackingComponentTest.java +++ b/source/test-java/org/alfresco/repo/solr/SOLRTrackingComponentTest.java @@ -21,7 +21,6 @@ package org.alfresco.repo.solr; import java.io.InputStream; import java.io.Serializable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -139,20 +138,25 @@ public class SOLRTrackingComponentTest extends TestCase { List cs = solrTrackingComponent.getAclChangeSets(null, null, null, null, 50); assertTrue("Expected results to be limited in number", cs.size() <= 50); + List aclChangeSetIds = new ArrayList(50); int totalAcls = 0; for (AclChangeSet aclChangeSet : cs) { + aclChangeSetIds.add(aclChangeSet.getId()); totalAcls += aclChangeSet.getAclCount(); } int totalAclsCheck = 0; - - for (AclChangeSet aclChangeSet : cs) + Long fromAclId = null; + while (true) { - List acls = solrTrackingComponent.getAcls(Arrays.asList(new Long[]{aclChangeSet.getId()}), null, 200); - assertEquals(aclChangeSet.getAclCount(), acls.size()); + List acls = solrTrackingComponent.getAcls(aclChangeSetIds, fromAclId, 2); + if (acls.size() == 0) + { + break; + } totalAclsCheck += acls.size(); + fromAclId = acls.get(acls.size() - 1).getId() + 1; } - // Double check number of ACLs assertEquals("ACL count should have matched", totalAcls, totalAclsCheck); }