Mohit Arora created SLING-9044:
----------------------------------

             Summary: Use traversal to list resource distribution queue items.
                 Key: SLING-9044
                 URL: https://issues.apache.org/jira/browse/SLING-9044
             Project: Sling
          Issue Type: Bug
          Components: Content Distribution
            Reporter: Mohit Arora
             Fix For: Content Distribution Core 0.4.2


[ResourceQueueUtils# 
getResourceCount()|https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/queue/impl/resource/ResourceQueueUtils.java#L320]
 function is responsible for triggering an xpath query to get the resource 
queue items. This query tries to find all the {{nt:unstructured}} nodes under a 
resource queue's path. This query is currently not backed by any index 
definition. This leads to a warning like below being logged when a request is 
made to list the items of resource queue - 

{code}11.12.2019 14:15:46.926 *WARN* [0:0:0:0:0:0:0:1 [1576053946802] GET 
/libs/granite/distribution/content/distribution-agent.html HTTP/1.1] 
org.apache.jackrabbit.oak.query.QueryImpl Traversal query (query without 
index): select [jcr:path], [jcr:score], * from [nt:unstructured] as a where 
isdescendantnode(a, 
'/var/sling/distribution/queues/bpqatest0/error-endpoint-bpqatest0') /* xpath: 
/jcr:root/var/sling/distribution/queues/bpqatest0/error-endpoint-bpqatest0//element(*,nt:unstructured)
 */; consider creating an index
{code}

Switching to traversal here would be as efficient as writing an index for this 
query. 

Further, since a resource queue can also be an {{active}} queue and the items 
will come and go, the indexer will have to do extra work of indexing the 
transient items.

The xpath query looks something like - 

{code}/jcr:root/var/sling/distribution/queues//element(*,nt:unstructured)[@jcr:primaryType='nt:unstructured']
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to