8000 Add limits for AQL query complexity by jsteemann · Pull Request #14480 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Add limits for AQL query complexity #14480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
try with adjusted limits
  • Loading branch information
jsteemann committed Jul 9, 2021
commit 6ad1ad60a58987d14a418755883b5101e646630b
6 changes: 3 additions & 3 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ devel
passes etc.).
This change introduces 2 limits:
- a recursion limit for AQL query expressions. An expression can now be
up to 1,000 levels deep. An example expression is `1 + 2 + 3 + 4`, which
up to 500 levels deep. An example expression is `1 + 2 + 3 + 4`, which
is 3 levels deep `1 + (2 + (3 + 4))`.
The expression recursion is limited to 1,000 levels.
The expression recursion is limited to 500 levels.
- a limit for the number of execution nodes in the initial query
execution plan.
The number of execution nodes is limited to 4,000.
The number of execution nodes is limited to 3,000.

* APM-112: invalid use of OPTIONS in AQL queries will now raise a warning in
the query.
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/Ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Ast {
~Ast();

/// @brief maximum nesting level for expressions
static constexpr uint64_t maxExpressionNesting = 1000;
static constexpr uint64_t maxExpressionNesting = 500;

/// @brief return the query
QueryContext& query() const { return _query; }
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/ExecutionPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ExecutionPlan {
/// (at the time the initial execution plan is created). we have to limit
/// this to prevent super-long runtimes for query optimization and
/// execution)
static constexpr uint64_t maxPlanNodes = 4000;
static constexpr uint64_t maxPlanNodes = 3000;

/// @brief create an execution plan from an AST
/// note: tracking memory usage requires accessing the Ast/Query objects,
Expand Down
8 changes: 4 additions & 4 deletions tests/js/server/aql/aql-queries-simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ function ahuacatlQuerySimpleTestSuite () {

testQueryWithManyNodes : function() {
let q = "LET x = NOOPT('testi')\n";
const cnt = 4000 - 4; // singleton + calculation + calculation + return
const cnt = 3000 - 4; // singleton + calculation + calculation + return
for (let i = 0; i < cnt; ++i) {
q += `FILTER x\n `;
}
Expand All @@ -1371,7 +1371,7 @@ function ahuacatlQuerySimpleTestSuite () {

testQueryWithTooManyNodes : function() {
let q = "LET x = NOOPT('testi')\n";
const cnt = 4000; // plus singleton + calculation + calculation + return
const cnt = 3000; // plus singleton + calculation + calculation + return
for (let i = 0; i < cnt; ++i) {
q += `FILTER x\n `;
}
Expand All @@ -1381,7 +1381,7 @@ function ahuacatlQuerySimpleTestSuite () {

testQueryWithDeepExpression : function() {
let q = "RETURN 0";
const cnt = 1000 - 2;
const cnt = 500 - 2;
for (let i = 1; i <= cnt; ++i) {
q += " + " + i;
}
Expand All @@ -1390,7 +1390,7 @@ function ahuacatlQuerySimpleTestSuite () {

testQueryWithTooDeepExpression : function() {
let q = "RETURN 0";
const cnt = 1000;
const cnt = 500;
for (let i = 0; i < cnt; ++i) {
q += " + " + i;
}
Expand Down
0