From 66f799f3c6da6a701db5512f1149956053bd6cb2 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 31 Jan 2015 12:10:16 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud) 93084: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 93040: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1) 92868: Merged DEV (4.2.5) to V4.2-BUG-FIX (4.2.5) 92789: MNT-12832: Excessive startup time when using MySQL when many nodes found at first level in Stores and using Lucene search engine. FIxed IndexConfigurationCheckerImpl to use count of child assocs. 93050: MNT-12832: Excessive startup time when using MySQL when many nodes found at first level in Stores and using Lucene search engine. - Added PROTOCOL_AVM constant to resolve compilation error in 5.0.N (build #34) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94934 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../admin/IndexConfigurationCheckerImpl.java | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/repo/admin/IndexConfigurationCheckerImpl.java b/source/java/org/alfresco/repo/admin/IndexConfigurationCheckerImpl.java index b944e6d889..5eeb18c40b 100644 --- a/source/java/org/alfresco/repo/admin/IndexConfigurationCheckerImpl.java +++ b/source/java/org/alfresco/repo/admin/IndexConfigurationCheckerImpl.java @@ -101,8 +101,45 @@ public class IndexConfigurationCheckerImpl implements IndexConfigurationChecker // Are we creating the store - in which case we do not check // See MNT-11612 - List childAssocs = nodeService.getChildAssocs(rootNodeRef, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, 1, false); - if(childAssocs.size() == 0) + int countChildAssoc = 0; + if (storeRef.getProtocol().equals(StoreRef.PROTOCOL_AVM)) + { + // AVM does not support nodeService.countChildAssocs() + long start = 0; + if (logger.isDebugEnabled()) + { + logger.debug("Counting childAssocs for store: " + storeRef); + start = System.currentTimeMillis(); + } + List childAssocs = nodeService.getChildAssocs(rootNodeRef, + RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, 1, false); + countChildAssoc = childAssocs.size(); + if (logger.isDebugEnabled()) + { + logger.debug("Time for counting childAssocs for : " + storeRef + " time=" + + (System.currentTimeMillis() - start)); + } + } + else + { + long start = 0; + if (logger.isDebugEnabled()) + { + logger.debug("Counting childAssocs for store: " + storeRef); + start = System.currentTimeMillis(); + } + countChildAssoc = nodeService.countChildAssocs(rootNodeRef, true); + if (logger.isDebugEnabled()) + { + logger.debug("Time for counting childAssocs for : " + storeRef + " time=" + + (System.currentTimeMillis() - start)); + } + } + if (logger.isDebugEnabled()) + { + logger.debug("Counting childAssocs for store: " + storeRef + " countChildAssoc = " + countChildAssoc); + } + if (countChildAssoc == 0) { continue; }