diff --git a/config/alfresco/cache-context.xml b/config/alfresco/cache-context.xml index 9943592d43..1b1f3f6540 100644 --- a/config/alfresco/cache-context.xml +++ b/config/alfresco/cache-context.xml @@ -39,11 +39,14 @@ - userToAuthorityCache + org.alfresco.userToAuthorityCache 10000 + + true + false @@ -61,10 +64,10 @@ - userToAuthorityTransactionalCache + org.alfresco.userToAuthorityTransactionalCache - 5000 + 100 @@ -81,11 +84,14 @@ - permissionsAccessCache + org.alfresco.permissionsAccessCache 50000 + + true + false @@ -104,10 +110,10 @@ - permissionsAccessTransactionalCache + org.alfresco.permissionsAccessTransactionalCache - 5000 + 10000 @@ -124,11 +130,14 @@ - nodeOwnerCache + org.alfresco.nodeOwnerCache 20000 + + true + false @@ -146,10 +155,10 @@ - nodeOwnerTransactionalCache + org.alfresco.nodeOwnerTransactionalCache - 5000 + 10000 @@ -166,11 +175,14 @@ - ticketsCache + org.alfresco.ticketsCache 1000 + + true + false @@ -188,7 +200,7 @@ - ticketsTransactionalCache + org.alfresco.ticketsTransactionalCache 10 diff --git a/config/alfresco/public-services-security-context.xml b/config/alfresco/public-services-security-context.xml index f43f65ead5..8bf50fbdf2 100644 --- a/config/alfresco/public-services-security-context.xml +++ b/config/alfresco/public-services-security-context.xml @@ -212,10 +212,10 @@ - ${lucene.query.maxPermissionCheckTimeMillis} + ${system.acl.maxPermissionCheckTimeMillis} - ${lucene.query.maxPermissionChecks} + ${system.acl.maxPermissionChecks} @@ -352,6 +352,7 @@ org.alfresco.service.cmr.repository.NodeService.setProperty=ACL_NODE.0.sys:base.WriteProperties org.alfresco.service.cmr.repository.NodeService.getParentAssocs=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_PARENT.sys:base.Read org.alfresco.service.cmr.repository.NodeService.getChildAssocs=ACL_NODE.0.sys:base.ReadChildren,AFTER_ACL_NODE.sys:base.Read + org.alfresco.service.cmr.repository.NodeService.getChildByName=ACL_NODE.0.sys:base.ReadChildren,AFTER_ACL_NODE.sys:base.Read org.alfresco.service.cmr.repository.NodeService.getPrimaryParent=ACL_NODE.0.sys:base.ReadProperties,AFTER_ACL_PARENT.sys:base.Read org.alfresco.service.cmr.repository.NodeService.createAssociation=ROLE_AUTHENTICATED org.alfresco.service.cmr.repository.NodeService.removeAssociation=ROLE_AUTHENTICATED @@ -653,6 +654,10 @@ org.alfresco.service.cmr.security.AuthenticationService.getCurrentTicket=ACL_ALLOW org.alfresco.service.cmr.security.AuthenticationService.clearCurrentSecurityContext=ACL_ALLOW org.alfresco.service.cmr.security.AuthenticationService.isCurrentUserTheSystemUser=ACL_ALLOW + org.alfresco.service.cmr.security.AuthenticationService.getDomains=ACL_METHOD.ROLE_ADMINISTRATOR + org.alfresco.service.cmr.security.AuthenticationService.getDomainsThatAllowUserCreation=ACL_METHOD.ROLE_ADMINISTRATOR + org.alfresco.service.cmr.security.AuthenticationService.getDomainsThatAllowUserDeletion=ACL_METHOD.ROLE_ADMINISTRATOR + org.alfresco.service.cmr.security.AuthenticationService.getDomiansThatAllowUserPasswordChanges=ACL_METHOD.ROLE_ADMINISTRATOR @@ -698,6 +703,8 @@ org.alfresco.service.cmr.security.PersonService.deletePerson=ACL_METHOD.ROLE_ADMINISTRATOR org.alfresco.service.cmr.security.PersonService.getAllPeople=ACL_ALLOW org.alfresco.service.cmr.security.PersonService.getPeopleContainer=ACL_ALLOW + org.alfresco.service.cmr.security.PersonService.getUserNamesAreCaseSensitive=ACL_ALLOW + org.alfresco.service.cmr.security.PersonService.getUserIdentifier=ACL_ALLOW diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index 8f4d0b213c..ed4459e811 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -19,18 +19,18 @@ index.recovery.mode=VALIDATE # Change the failure behaviour of the configuration checker system.bootstrap.config_check.strict=true +# +# Properties to limit resources spent on individual searches +# +# The maximum time spent pruning results +system.acl.maxPermissionCheckTimeMillis=10000 +# The maximum number of results to perform permission checks against +system.acl.maxPermissionChecks=1000 + # #################### # # Lucene configuration # # #################### # # -# The maximum time spent pruning query results -# -lucene.query.maxPermissionCheckTimeMillis=10000 -# -# The maximum number of results to perform permission checks against -# -lucene.query.maxPermissionChecks=1000 -# # Millisecond threshold for text transformations # Slower transformers will force the text extraction to be asynchronous # diff --git a/source/java/org/alfresco/repo/admin/patch/impl/InvalidNameEndingPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/InvalidNameEndingPatch.java index 05205f7487..729b272e53 100644 --- a/source/java/org/alfresco/repo/admin/patch/impl/InvalidNameEndingPatch.java +++ b/source/java/org/alfresco/repo/admin/patch/impl/InvalidNameEndingPatch.java @@ -52,6 +52,22 @@ public class InvalidNameEndingPatch extends AbstractPatch private SessionFactory sessionFactory; private NodeDaoService nodeDaoService; + + public static void main(String[] args) + { + String name = "fred. ... "; + + int i = (name.length() == 0) ? 0 : name.length() - 1; + while (i >= 0 && (name.charAt(i) == '.' || name.charAt(i) == ' ')) + { + i--; + } + + String updatedName = (i == 0) ? "unnamed" : name.substring(0, i + 1); + System.out.println(updatedName); + } + + public InvalidNameEndingPatch() { } @@ -149,7 +165,7 @@ public class InvalidNameEndingPatch extends AbstractPatch i--; } - String updatedName = name.substring(0, i); + String updatedName = (i == 0) ? "unnamed" : name.substring(0, i + 1); int idx = 0; boolean applied = false; while (!applied) diff --git a/source/java/org/alfresco/repo/cache/EhCacheTracerJob.java b/source/java/org/alfresco/repo/cache/EhCacheTracerJob.java index 2113fb4b3c..2ae902d4b3 100644 --- a/source/java/org/alfresco/repo/cache/EhCacheTracerJob.java +++ b/source/java/org/alfresco/repo/cache/EhCacheTracerJob.java @@ -62,10 +62,7 @@ public class EhCacheTracerJob implements Job { try { - if (logger.isDebugEnabled()) - { - execute(); - } + execute(); } catch (Throwable e) { @@ -86,6 +83,7 @@ public class EhCacheTracerJob implements Job // get all the caches String[] cacheNames = cacheManager.getCacheNames(); logger.debug("Dumping EHCache info:"); + boolean analyzeAll = true; for (String cacheName : cacheNames) { Cache cache = cacheManager.getCache(cacheName); @@ -93,27 +91,39 @@ public class EhCacheTracerJob implements Job { continue; } + Log cacheLogger = LogFactory.getLog(this.getClass().getName() + "." + cacheName); + // log each cache to its own logger // dump - CacheAnalysis analysis = new CacheAnalysis(cache); - logger.debug(analysis); - // get the size - allCachesTotalSize += analysis.getSize(); - double cacheEstimatedMaxSize = analysis.getEstimatedMaxSize(); - estimatedMaxSize += (Double.isNaN(cacheEstimatedMaxSize) || Double.isInfinite(cacheEstimatedMaxSize)) - ? 0.0 - : cacheEstimatedMaxSize; + if (cacheLogger.isDebugEnabled()) + { + CacheAnalysis analysis = new CacheAnalysis(cache); + cacheLogger.debug(analysis); + // get the size + allCachesTotalSize += analysis.getSize(); + double cacheEstimatedMaxSize = analysis.getEstimatedMaxSize(); + estimatedMaxSize += (Double.isNaN(cacheEstimatedMaxSize) || Double.isInfinite(cacheEstimatedMaxSize)) + ? 0.0 + : cacheEstimatedMaxSize; + } + else + { + analyzeAll = false; + } + } + if (analyzeAll) + { + // check the size + double sizePercentage = (double)allCachesTotalSize / (double)maxHeapSize * 100.0; + double maxSizePercentage = estimatedMaxSize / (double)maxHeapSize * 100.0; + String msg = String.format( + "EHCaches currently consume %5.2f MB or %3.2f percent of system VM size. \n" + + "The estimated maximum size is %5.2f MB or %3.2f percent of system VM size.", + (double)allCachesTotalSize / 1024.0 / 1024.0, + sizePercentage, + estimatedMaxSize / 1024.0 / 1024.0, + maxSizePercentage); + logger.debug(msg); } - // check the size - double sizePercentage = (double)allCachesTotalSize / (double)maxHeapSize * 100.0; - double maxSizePercentage = estimatedMaxSize / (double)maxHeapSize * 100.0; - String msg = String.format( - "EHCaches currently consume %5.2f MB or %3.2f percent of system VM size. \n" + - "The estimated maximum size is %5.2f MB or %3.2f percent of system VM size.", - (double)allCachesTotalSize / 1024.0 / 1024.0, - sizePercentage, - estimatedMaxSize / 1024.0 / 1024.0, - maxSizePercentage); - logger.debug(msg); } private static class CacheAnalysis @@ -211,15 +221,17 @@ public class EhCacheTracerJob implements Job long maxSize = cache.getMaxElementsInMemory(); long currentSize = cache.getMemoryStoreSize(); long hitCount = cache.getHitCount(); - long missCount = cache.getMissCountNotFound(); + long totalMissCount = cache.getMissCountNotFound() + cache.getMissCountExpired(); + double hitRatio = (double)hitCount / (double)(totalMissCount + hitCount) * 100.0; double percentageFull = (double)currentSize / (double)maxSize * 100.0; double estMaxSize = sizeMB / (double) currentSize * (double) maxSize; StringBuilder sb = new StringBuilder(512); - sb.append(" Analyzing EHCache: \n") - .append("===> ").append(cache.getName()).append("\n") - .append(" Hit Count: ").append(String.format("%10d hits ", hitCount )) - .append(" | Miss Count: ").append(String.format("%10d misses ", missCount )).append("\n") + sb.append("\n") + .append("===> EHCache: ").append(cache).append("\n") + .append(" Hit Ratio: ").append(String.format("%10.2f percent ", hitRatio )) + .append(" | Hit Count: ").append(String.format("%10d hits ", hitCount )) + .append(" | Miss Count: ").append(String.format("%10d misses ", totalMissCount )).append("\n") .append(" Deep Size: ").append(String.format("%10.2f MB ", sizeMB )) .append(" | Current Count: ").append(String.format("%10d entries ", currentSize )).append("\n") .append(" Percentage used: ").append(String.format("%10.2f percent", percentageFull)) diff --git a/source/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java b/source/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java index a9aced6b81..d1052dea2c 100644 --- a/source/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java +++ b/source/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java @@ -23,6 +23,7 @@ import java.util.List; import junit.framework.TestCase; +import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.transform.AbstractContentTransformerTest; import org.alfresco.repo.security.authentication.AuthenticationComponent; @@ -36,8 +37,8 @@ import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.GUID; @@ -66,7 +67,6 @@ public class FileFolderPerformanceTester extends TestCase private AuthenticationComponent authenticationComponent; private NodeService nodeService; private FileFolderService fileFolderService; - private StoreRef storeRef; private NodeRef rootFolderRef; private File dataFile; @@ -78,18 +78,30 @@ public class FileFolderPerformanceTester extends TestCase authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent"); nodeService = serviceRegistry.getNodeService(); fileFolderService = serviceRegistry.getFileFolderService(); + SearchService searchService = serviceRegistry.getSearchService(); // authenticate authenticationComponent.setSystemUserAsCurrentUser(); - // create a folder root to work in - storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + "_" + System.currentTimeMillis()); - NodeRef rootNodeRef = nodeService.getRootNode(storeRef); - rootFolderRef = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.ALFRESCO_URI, getName()), - ContentModel.TYPE_FOLDER).getChildRef(); + // find the guest folder + StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home"); + try + { + if (rs.length() == 0) + { + throw new AlfrescoRuntimeException("Didn't find Company Home"); + } + NodeRef companyHomeNodeRef = rs.getNodeRef(0); + rootFolderRef = fileFolderService.create( + companyHomeNodeRef, + getName() + "_" + System.currentTimeMillis(), + ContentModel.TYPE_FOLDER).getNodeRef(); + } + finally + { + rs.close(); + } dataFile = AbstractContentTransformerTest.loadQuickTestFile("txt"); } @@ -302,16 +314,12 @@ public class FileFolderPerformanceTester extends TestCase } } - public void test_1_ordered_1_10() throws Exception - { - buildStructure(rootFolderRef, 1, false, 1, 10, null); - } -// public void test_1_ordered_1_10_read() throws Exception +// /** Load 5000 files into a single folder using 2 threads */ +// public void test_2_ordered_1_2500() throws Exception // { -// buildStructure(rootFolderRef, 1, false, 50, 1, null); -// readStructure(rootFolderRef, 50, 1000, null); +// buildStructure(rootFolderRef, 2, false, 1, 2500, new double[] {0.25, 0.50, 0.75}); // } -// + // public void test_4_ordered_10_100() throws Exception // { // buildStructure(rootFolderRef, 4, false, 10, 100, new double[] {0.25, 0.50, 0.75}); @@ -341,16 +349,16 @@ public class FileFolderPerformanceTester extends TestCase // 400, // new double[] {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90}); // } - public void test_4_shuffled_10_100() throws Exception - { - buildStructure( - rootFolderRef, - 4, - true, - 10, - 100, - new double[] {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90}); - } +// public void test_4_shuffled_10_100() throws Exception +// { +// buildStructure( +// rootFolderRef, +// 4, +// true, +// 10, +// 100, +// new double[] {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90}); +// } // public void test_1_ordered_1_50000() throws Exception // { // buildStructure( diff --git a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java index d12f7153cc..184a895833 100644 --- a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java +++ b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java @@ -487,6 +487,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl } // set the index assoc.setIndex(index); + // flush + nodeDaoService.flush(); } public QName getType(NodeRef nodeRef) throws InvalidNodeRefException diff --git a/source/java/org/alfresco/repo/node/db/hibernate/HibernateNodeDaoServiceImpl.java b/source/java/org/alfresco/repo/node/db/hibernate/HibernateNodeDaoServiceImpl.java index 0a57c5514b..3f9a39d858 100644 --- a/source/java/org/alfresco/repo/node/db/hibernate/HibernateNodeDaoServiceImpl.java +++ b/source/java/org/alfresco/repo/node/db/hibernate/HibernateNodeDaoServiceImpl.java @@ -676,6 +676,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements { Query query = session .getNamedQuery(HibernateNodeDaoServiceImpl.QUERY_GET_CHILD_ASSOCS) + .setFlushMode(FlushMode.NEVER) .setLong("parentId", parentNode.getId()); return query.list(); } @@ -693,6 +694,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements { Query query = session .getNamedQuery(HibernateNodeDaoServiceImpl.QUERY_GET_CHILD_ASSOC_REFS) + .setFlushMode(FlushMode.NEVER) .setLong("parentId", parentNode.getId()); return query.list(); } @@ -712,6 +714,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements { Query query = session .getNamedQuery(HibernateNodeDaoServiceImpl.QUERY_GET_CHILD_ASSOC_REFS_BY_QNAME) + .setFlushMode(FlushMode.NEVER) .setLong("parentId", parentNode.getId()) .setParameter("childAssocQName", assocQName); return query.list(); diff --git a/source/java/org/alfresco/repo/security/authentication/ntlm/NTLMAuthenticationComponentImpl.java b/source/java/org/alfresco/repo/security/authentication/ntlm/NTLMAuthenticationComponentImpl.java index 9ee09959c9..bfce13d21a 100644 --- a/source/java/org/alfresco/repo/security/authentication/ntlm/NTLMAuthenticationComponentImpl.java +++ b/source/java/org/alfresco/repo/security/authentication/ntlm/NTLMAuthenticationComponentImpl.java @@ -484,7 +484,6 @@ public class NTLMAuthenticationComponentImpl extends AbstractAuthenticationCompo // Authenticate using the token authenticate( authToken); - setCurrentUser( userName.toLowerCase()); } /**