[ 
https://issues.apache.org/jira/browse/SLING-8407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837320#comment-16837320
 ] 

Vikas Saurabh commented on SLING-8407:
--------------------------------------

[~marett],
bq. ....  to wait on a specific marker service and thus a specific index.
actually that won't work as well. Queries and indexes are de-coupled (not just 
in oak ... in a lot of DBs too). So, making a client know "which" index it 
should use for a query is troublesome in long run (I think). The intention is 
probably that the query should be backed by an index which is what {{option 
(traversal fail)}} indicates. But I don't know much osgi to say "try running 
this query with option traversal fail whenever a new index gets ready... once 
this is done then go on to call activate".

Also, that said, I don't completely agree to the idea of not allowing job 
manager impl at all just because find jobs functionality needs something which 
isn't ready. As [~tmueller] mentioned earlier - first setup is one case but 
imagine a case where the index which "should" answer query via {{findJobs}} is 
corrupt for some reason. Should that result in inability to addJobs as well?

> 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
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to