Package org.apache.jackrabbit.oak.query
Class QueryEngineSettings
- java.lang.Object
-
- org.apache.jackrabbit.oak.query.QueryEngineSettings
-
- All Implemented Interfaces:
QueryEngineSettingsMBean
,QueryLimits
public class QueryEngineSettings extends Object implements QueryEngineSettingsMBean, QueryLimits
Settings of the query engine.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_FAST_QUERY_SIZE
static int
DEFAULT_PREFETCH_COUNT
static long
DEFAULT_QUERY_LIMIT_IN_MEMORY
static long
DEFAULT_QUERY_LIMIT_READS
static String
FT_NAME_IMPROVED_IS_NULL_COST
static String
FT_NAME_PREFETCH_FOR_QUERIES
static String
FT_OPTIMIZE_IN_RESTRICTIONS_FOR_FUNCTIONS
static String
OAK_QUERY_FAIL_TRAVERSAL
static String
OAK_QUERY_LIMIT_IN_MEMORY
static String
OAK_QUERY_LIMIT_READS
static String
OAK_QUERY_PREFETCH_COUNT
static String
SQL2_OPTIMISATION_FLAG
the flag used to turn on/off the optimisations on top of theorg.apache.jackrabbit.oak.query.Query
object.static String
SQL2_OPTIMISATION_FLAG_2
static boolean
SQL2_OPTIMIZATION_2
-
Fields inherited from interface org.apache.jackrabbit.oak.api.jmx.QueryEngineSettingsMBean
TYPE
-
-
Constructor Summary
Constructors Constructor Description QueryEngineSettings()
QueryEngineSettings(StatisticsProvider statisticsProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryOptions.AutomaticQueryOptionsMapping
getAutomaticQueryOptions()
String
getAutoOptionsMappingJson()
Get the automatic query options mapping.boolean
getFailTraversal()
Whether queries that don't use an index will fail (throw an exception).boolean
getFullTextComparisonWithoutIndex()
@NotNull String[]
getIgnoredClassNamesInCallTrace()
Retrieve the java package names / full qualified class names which should be ignored when finding the class starting a queryboolean
getImprovedIsNullCost()
See OAK-10532.long
getLimitInMemory()
Get the limit on how many nodes a query may read at most into memory, for "order by" and "distinct" queries.long
getLimitReads()
Get the limit on how many nodes a query may read at most (raw read operations, including skipped nodes).boolean
getOptimizeInRestrictionsForFunctions()
See OAK-11214.int
getPrefetchCount()
Get the prefetch count.long
getQueryLengthErrorLimit()
long
getQueryLengthWarnLimit()
QueryStatsMBean
getQueryStats()
QueryStatsReporter
getQueryStatsReporter()
QueryValidator
getQueryValidator()
String
getQueryValidatorJson()
StatisticsProvider
getStatisticsProvider()
String
getStrictPathRestriction()
Whether Path restrictions are enabled while figuring out index planboolean
isFastQuerySize()
Whether the query result size should return an estimation for large queries.boolean
isSql2Optimisation()
void
setAutoOptionsMappingJson(String json)
Change the automatic query options mapping.void
setFailTraversal(boolean failTraversal)
Set whether queries that don't use an index will fail (throw an exception).void
setFastQuerySize(boolean fastQuerySize)
void
setFullTextComparisonWithoutIndex(boolean fullTextComparisonWithoutIndex)
void
setIgnoredClassNamesInCallTrace(@NotNull String[] packageNames)
Set or remove java package/class names which are ignored from finding the invoking class for queries.void
setImprovedIsNullCostFeature(@Nullable Feature feature)
void
setLimitInMemory(long limitInMemory)
Change the limit.void
setLimitReads(long limitReads)
Change the limit.void
setOptimizeInRestrictionsForFunctions(@Nullable Feature feature)
void
setPrefetchCount(int prefetchCount)
Change the prefetch count.void
setPrefetchFeature(@Nullable Feature prefetch)
void
setQueryValidatorPattern(String key, String pattern, String comment, boolean failQuery)
Set or remove a query validator pattern.void
setStrictPathRestriction(String strictPathRestriction)
Whether path restrictions of indexes (excludedPaths / includedPaths) are taken into account during query execution, for Lucene indexes.String
toString()
-
-
-
Field Detail
-
SQL2_OPTIMISATION_FLAG
public static final String SQL2_OPTIMISATION_FLAG
the flag used to turn on/off the optimisations on top of theorg.apache.jackrabbit.oak.query.Query
object.-Doak.query.sql2optimisation
- See Also:
- Constant Field Values
-
SQL2_OPTIMISATION_FLAG_2
public static final String SQL2_OPTIMISATION_FLAG_2
- See Also:
- Constant Field Values
-
SQL2_OPTIMIZATION_2
public static final boolean SQL2_OPTIMIZATION_2
-
OAK_QUERY_LIMIT_IN_MEMORY
public static final String OAK_QUERY_LIMIT_IN_MEMORY
- See Also:
- Constant Field Values
-
DEFAULT_QUERY_LIMIT_IN_MEMORY
public static final long DEFAULT_QUERY_LIMIT_IN_MEMORY
-
OAK_QUERY_LIMIT_READS
public static final String OAK_QUERY_LIMIT_READS
- See Also:
- Constant Field Values
-
DEFAULT_QUERY_LIMIT_READS
public static final long DEFAULT_QUERY_LIMIT_READS
-
OAK_QUERY_PREFETCH_COUNT
public static final String OAK_QUERY_PREFETCH_COUNT
- See Also:
- Constant Field Values
-
FT_NAME_PREFETCH_FOR_QUERIES
public static final String FT_NAME_PREFETCH_FOR_QUERIES
- See Also:
- Constant Field Values
-
FT_NAME_IMPROVED_IS_NULL_COST
public static final String FT_NAME_IMPROVED_IS_NULL_COST
- See Also:
- Constant Field Values
-
FT_OPTIMIZE_IN_RESTRICTIONS_FOR_FUNCTIONS
public static final String FT_OPTIMIZE_IN_RESTRICTIONS_FOR_FUNCTIONS
- See Also:
- Constant Field Values
-
DEFAULT_PREFETCH_COUNT
public static final int DEFAULT_PREFETCH_COUNT
-
OAK_QUERY_FAIL_TRAVERSAL
public static final String OAK_QUERY_FAIL_TRAVERSAL
- See Also:
- Constant Field Values
-
DEFAULT_FAST_QUERY_SIZE
public static final boolean DEFAULT_FAST_QUERY_SIZE
-
-
Constructor Detail
-
QueryEngineSettings
public QueryEngineSettings()
-
QueryEngineSettings
public QueryEngineSettings(StatisticsProvider statisticsProvider)
-
-
Method Detail
-
getQueryLengthWarnLimit
public long getQueryLengthWarnLimit()
-
getQueryLengthErrorLimit
public long getQueryLengthErrorLimit()
-
setPrefetchFeature
public void setPrefetchFeature(@Nullable @Nullable Feature prefetch)
-
getLimitInMemory
public long getLimitInMemory()
Description copied from interface:QueryEngineSettingsMBean
Get the limit on how many nodes a query may read at most into memory, for "order by" and "distinct" queries. If this limit is exceeded, the query throws an exception.- Specified by:
getLimitInMemory
in interfaceQueryEngineSettingsMBean
- Specified by:
getLimitInMemory
in interfaceQueryLimits
- Returns:
- the limit
-
setLimitInMemory
public void setLimitInMemory(long limitInMemory)
Description copied from interface:QueryEngineSettingsMBean
Change the limit.- Specified by:
setLimitInMemory
in interfaceQueryEngineSettingsMBean
- Parameters:
limitInMemory
- the new limit
-
getLimitReads
public long getLimitReads()
Description copied from interface:QueryEngineSettingsMBean
Get the limit on how many nodes a query may read at most (raw read operations, including skipped nodes). If this limit is exceeded, the query throws an exception.- Specified by:
getLimitReads
in interfaceQueryEngineSettingsMBean
- Specified by:
getLimitReads
in interfaceQueryLimits
- Returns:
- the limit
-
setLimitReads
public void setLimitReads(long limitReads)
Description copied from interface:QueryEngineSettingsMBean
Change the limit.- Specified by:
setLimitReads
in interfaceQueryEngineSettingsMBean
- Parameters:
limitReads
- the new limit
-
setPrefetchCount
public void setPrefetchCount(int prefetchCount)
Description copied from interface:QueryEngineSettingsMBean
Change the prefetch count.- Specified by:
setPrefetchCount
in interfaceQueryEngineSettingsMBean
- Parameters:
prefetchCount
- the new count
-
getPrefetchCount
public int getPrefetchCount()
Description copied from interface:QueryEngineSettingsMBean
Get the prefetch count.- Specified by:
getPrefetchCount
in interfaceQueryEngineSettingsMBean
- Returns:
- the count
-
setAutoOptionsMappingJson
public void setAutoOptionsMappingJson(String json)
Description copied from interface:QueryEngineSettingsMBean
Change the automatic query options mapping.- Specified by:
setAutoOptionsMappingJson
in interfaceQueryEngineSettingsMBean
- Parameters:
json
- the new mapping, in Json format
-
getAutoOptionsMappingJson
public String getAutoOptionsMappingJson()
Description copied from interface:QueryEngineSettingsMBean
Get the automatic query options mapping.- Specified by:
getAutoOptionsMappingJson
in interfaceQueryEngineSettingsMBean
- Returns:
- the mapping, in Json format
-
getAutomaticQueryOptions
public QueryOptions.AutomaticQueryOptionsMapping getAutomaticQueryOptions()
-
getFailTraversal
public boolean getFailTraversal()
Description copied from interface:QueryEngineSettingsMBean
Whether queries that don't use an index will fail (throw an exception). The default is false.- Specified by:
getFailTraversal
in interfaceQueryEngineSettingsMBean
- Specified by:
getFailTraversal
in interfaceQueryLimits
- Returns:
- true if they fail
-
setFailTraversal
public void setFailTraversal(boolean failTraversal)
Description copied from interface:QueryEngineSettingsMBean
Set whether queries that don't use an index will fail (throw an exception).- Specified by:
setFailTraversal
in interfaceQueryEngineSettingsMBean
- Parameters:
failTraversal
- the new value for this setting
-
isFastQuerySize
public boolean isFastQuerySize()
Description copied from interface:QueryEngineSettingsMBean
Whether the query result size should return an estimation for large queries.- Specified by:
isFastQuerySize
in interfaceQueryEngineSettingsMBean
- Returns:
- true if enabled
-
setFastQuerySize
public void setFastQuerySize(boolean fastQuerySize)
- Specified by:
setFastQuerySize
in interfaceQueryEngineSettingsMBean
-
setImprovedIsNullCostFeature
public void setImprovedIsNullCostFeature(@Nullable @Nullable Feature feature)
-
getImprovedIsNullCost
public boolean getImprovedIsNullCost()
Description copied from interface:QueryLimits
See OAK-10532. This method is used for backward compatibility (bug compatibility) only.- Specified by:
getImprovedIsNullCost
in interfaceQueryLimits
- Returns:
- true, except when backward compatibility for OAK-10532 is enabled
-
setOptimizeInRestrictionsForFunctions
public void setOptimizeInRestrictionsForFunctions(@Nullable @Nullable Feature feature)
-
getOptimizeInRestrictionsForFunctions
public boolean getOptimizeInRestrictionsForFunctions()
Description copied from interface:QueryLimits
See OAK-11214. This method is used for backward compatibility (bug compatibility) only.- Specified by:
getOptimizeInRestrictionsForFunctions
in interfaceQueryLimits
- Returns:
- true, except when backward compatibility for OAK-11214 is enabled
-
getStrictPathRestriction
public String getStrictPathRestriction()
Description copied from interface:QueryEngineSettingsMBean
Whether Path restrictions are enabled while figuring out index plan- Specified by:
getStrictPathRestriction
in interfaceQueryEngineSettingsMBean
- Specified by:
getStrictPathRestriction
in interfaceQueryLimits
- Returns:
- true if enabled
-
setStrictPathRestriction
public void setStrictPathRestriction(String strictPathRestriction)
Description copied from interface:QueryEngineSettingsMBean
Whether path restrictions of indexes (excludedPaths / includedPaths) are taken into account during query execution, for Lucene indexes. When enabled, only indexes are considered if the index path restriction is compatible with the query path restrictions. When disabled, only the queryPaths of the index is taken into account.- Specified by:
setStrictPathRestriction
in interfaceQueryEngineSettingsMBean
- Parameters:
strictPathRestriction
- Set path restriction: Expected value is either of ENABLE/DISABLE/WARN ENABLE: enable path restriction- Index won't be used if index definition path restrictions are not compatible with query's path restriction DISABLE: path restrictions are not taken into account while querying WARN: path restrictions are not taken into account but a warning will be logged if query path restrictions are not compatible with index path restrictions
-
setFullTextComparisonWithoutIndex
public void setFullTextComparisonWithoutIndex(boolean fullTextComparisonWithoutIndex)
-
getFullTextComparisonWithoutIndex
public boolean getFullTextComparisonWithoutIndex()
- Specified by:
getFullTextComparisonWithoutIndex
in interfaceQueryLimits
-
isSql2Optimisation
public boolean isSql2Optimisation()
-
getQueryStats
public QueryStatsMBean getQueryStats()
-
getQueryStatsReporter
public QueryStatsReporter getQueryStatsReporter()
-
getStatisticsProvider
public StatisticsProvider getStatisticsProvider()
-
setQueryValidatorPattern
public void setQueryValidatorPattern(String key, String pattern, String comment, boolean failQuery)
Description copied from interface:QueryEngineSettingsMBean
Set or remove a query validator pattern.- Specified by:
setQueryValidatorPattern
in interfaceQueryEngineSettingsMBean
- Parameters:
key
- the keypattern
- the regular expression pattern (empty to remove the pattern)comment
- a commentfailQuery
- whether matching queries should fail (true) or just log a warning (false)
-
getQueryValidatorJson
public String getQueryValidatorJson()
- Specified by:
getQueryValidatorJson
in interfaceQueryEngineSettingsMBean
-
getQueryValidator
public QueryValidator getQueryValidator()
-
setIgnoredClassNamesInCallTrace
public void setIgnoredClassNamesInCallTrace(@NotNull @NotNull String[] packageNames)
Description copied from interface:QueryEngineSettingsMBean
Set or remove java package/class names which are ignored from finding the invoking class for queries. It can be either Java package names or fully-qualified class names (package + class name).- Specified by:
setIgnoredClassNamesInCallTrace
in interfaceQueryEngineSettingsMBean
- Parameters:
packageNames
- the class names to be ignored.
-
getIgnoredClassNamesInCallTrace
@NotNull public @NotNull String[] getIgnoredClassNamesInCallTrace()
Description copied from interface:QueryLimits
Retrieve the java package names / full qualified class names which should be ignored when finding the class starting a query- Specified by:
getIgnoredClassNamesInCallTrace
in interfaceQueryEngineSettingsMBean
- Specified by:
getIgnoredClassNamesInCallTrace
in interfaceQueryLimits
- Returns:
- the name of the packages / full qualified class names
-
-