[ https://issues.apache.org/jira/browse/SLING-8407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837247#comment-16837247 ]
Jason E Bailey commented on SLING-8407: --------------------------------------- [~tmueller] Allow me to provide a thought exercise. Which is faster? To run a query to find the children of a specific node, or to call node.getChildren()? From all of my experience and testing it's the getChildren() function. There is no doubt that if you don't know where the data is, that running a properly tuned indexed search is the fast and efficient way to go. However if you all the nodes are in one place or in one specific tree structure. Then you're not really gaining anything. For jobs, at least the implementation I have, everything is under /var/eventing/jobs. > I assume with "oak traversal" you mean "tree traversal within the query > engine", and with "tree traversal" you mean traversing a tree using the JCR > API (getNodes,...). I'll admit I haven't had the time to dive into oak as much as I'd like. I've seen a lot of strange things come out of oak as a result. I've had my whole system go down once because it was returning a result set, but every time I asked for the next item in the result set it was actually performing the query again. So I'll take your word on this. In a real world scenario, I use [https://github.com/apache/sling-org-apache-sling-resource-filter] ,which I wrote, in multiple production environments and the teams I've worked with have found that using this has had no negative impact on performance. Which brings me back to this bundle, if there is an issue where the index may not be available and you can do it efficiently without an index. Don't use an index. > JobManagerImpl.findJobs should prevent traversal > ------------------------------------------------ > > Key: SLING-8407 > URL: https://issues.apache.org/jira/browse/SLING-8407 > Project: Sling > Issue Type: Improvement > Components: Event > Reporter: Thomas Mueller > Priority: Major > > The method > [JobManagerImpl.findJobs|https://github.com/apache/sling-org-apache-sling-event/blob/master/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java#L373] > runs a JCR query to find all jobs for a topic. > It is possible that such a query is running while the repository isn't > initialized yet, meaning while the index isn't available yet. What is > happening in this case is that the query is traversing all nodes below that > path, triggering a warning that the query doesn't use an index. It is > sometimes happening when a health check is running before the repository is > initialized (ReplicationQueueHealthCheck and DistributionQueueHealthCheck). > It doesn't make sense that the query traverses the nodes. It should use an > index. If the index isn't available yet, it should fail. Therefore, the query > should use "option(traversal fail)". That would result in an exception that > can be caught. I will log a related issue to change the health checks to > process this exception and return HEALTH_CHECK_ERROR for this case. -- This message was sent by Atlassian JIRA (v7.6.3#76005)