[ https://issues.apache.org/jira/browse/SLING-11229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515352#comment-17515352 ]
Dan Klco commented on SLING-11229: ---------------------------------- Yes, that makes sense. Based on testing, this should be some percentage of the limit by default, e.g. 90% otherwise you still see the error. > 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.2 > > 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.1#820001)