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

Dan Klco commented on SLING-11229:
----------------------------------

Good question [~joerghoh] I think this is no longer relevant. 
 * I added options for LIMIT and OFFSET in OAK-9740
 * I also missed when testing this that Sling's error handling will handle the 
node read limit exception when reading the result set in the iterator so that 
issue is already handled

While the default behavior isn't _great_ and would likely cause performance 
issues on a running environment due to taking too long to execute, especially 
against a Document Node Store, this could be alleviated by reducing the query 
limit and avoided entirely by either specifying limits in the query object or 
in the OPTIONS of the query string.

> Add Option to Limit JCR Resource Provider Queries
> -------------------------------------------------
>
>                 Key: SLING-11229
>                 URL: https://issues.apache.org/jira/browse/SLING-11229
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR
>    Affects Versions: JCR Resource 3.2.0
>            Reporter: Dan Klco
>            Assignee: Dan Klco
>            Priority: Major
>             Fix For: JCR Resource 3.2.4
>
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> **Problem Statement**
> Currently, the [BasicQueryLanguageProvider 
> |https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/18edb8d7e7106c1e1e3333b89bf4d2a49c686e3b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java]
>  used by the 
> [JCRResourceProvider|https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/8345f4ed4857ed5ca240ac20050b68c84c61646c/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java]
>  for executing queries for methods like findResources executes a query 
> without a limit set.
> At the same time, in Apache Jackrabbit Oak, queries will fail if the query 
> reads more than a configurable limit of nodes:
> [https://jackrabbit.apache.org/oak/docs/query/query-engine.html#Slow_Queries_and_Read_Limits]
> This means that it's entirely possible to create a well indexed, well crafted 
> query in Apache Sling that will still throw an Exception at runtime for 
> larger repositories when using 
> [ResourceResolver.findResources|https://sling.apache.org/apidocs/sling12/org/apache/sling/api/resource/ResourceResolver.html#findResources-java.lang.String-java.lang.String-]
>  or 
> [ResourceResolver.queryResources|https://sling.apache.org/apidocs/sling12/org/apache/sling/api/resource/ResourceResolver.html#queryResources-java.lang.String-java.lang.String-]
>  if the query returns more than the Oak Read limit number of results.
> **Solution**
> Add an optional setting to the JCR Resource Provider to set a limit on the 
> number of returned results from queries. While this would mean that in 
> certain cases the queries would return an incomplete set of results, they 
> would still nevertheless return results rather than failing.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to