[
https://issues.apache.org/jira/browse/SLING-8407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16836348#comment-16836348
]
Stefan Egli commented on SLING-8407:
------------------------------------
I think we should not throw the RuntimeException due to backwards
compatibility. We already have many cases where WARNs are logged which would
now result in a RuntimeException (something to look at separately perhaps).
Here's an example of the exception:
{noformat}
09.05.2019 04:47:34.462 *WARN* | xxx | | [10.43.32.53 [1557370054384] POST
/libs/wcm/core/content/reference.json HTTP/1.1]
org.apache.sling.event.impl.jobs.JobManagerImpl : Query syntax wrong
/jcr:root/var/eventing/jobs//element(*,slingevent:Job)[@event.job.topic = 'xxx'
and not(@slingevent:finishedState) and ((@cq:path = '/a/b/c/d'f/my.jpg'))]
order by @slingevent:created ascending
org.apache.sling.api.resource.QuerySyntaxException: java.text.ParseException:
Query: /jcr:root/var/eventing/jobs//element(*,slingevent:Job)[@event.job.topic
= 'xxx' and not(@slingevent:finishedState) and ((@cq:path =
'/a/b/c/d'f/my.jpg(*)'))] order by @slingevent:created ascending
{noformat}
> 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)