Commit 831adb1e authored by Daniel Black's avatar Daniel Black

MDEV-17239 default max_recursive_iterations 4G -> 1000

A default 4G max_recursive_iterations allows users to far
to easily exhaust CPU, memory and time for a incorrect query.

Reduce this value down to 1000 consistent with Oracle MySQL's
cte_max_recursion_depth.
parent 2ad61c67
...@@ -1605,7 +1605,7 @@ max-join-size 18446744073709551615 ...@@ -1605,7 +1605,7 @@ max-join-size 18446744073709551615
max-length-for-sort-data 1024 max-length-for-sort-data 1024
max-password-errors 18446744073709551615 max-password-errors 18446744073709551615
max-prepared-stmt-count 16382 max-prepared-stmt-count 16382
max-recursive-iterations 18446744073709551615 max-recursive-iterations 1000
max-relay-log-size 1073741824 max-relay-log-size 1073741824
max-rowid-filter-size 131072 max-rowid-filter-size 131072
max-seeks-for-key 18446744073709551615 max-seeks-for-key 18446744073709551615
......
set max_recursive_iterations=200000;
create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10)); create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10));
insert into test_table(id, random_data, static_int, static_varchar) insert into test_table(id, random_data, static_int, static_varchar)
select id, random_data, 42, 'Hello' select id, random_data, 42, 'Hello'
...@@ -71,3 +72,4 @@ where variable_name like 'Sort_merge_passes'; ...@@ -71,3 +72,4 @@ where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
SORT_MERGE_PASSES WITH PASSES SORT_MERGE_PASSES WITH PASSES
drop table test_table; drop table test_table;
set max_recursive_iterations=default;
set max_recursive_iterations=200000;
create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10)); create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10));
insert into test_table(id, random_data, static_int, static_varchar) insert into test_table(id, random_data, static_int, static_varchar)
...@@ -48,3 +49,4 @@ from information_schema.session_status ...@@ -48,3 +49,4 @@ from information_schema.session_status
where variable_name like 'Sort_merge_passes'; where variable_name like 'Sort_merge_passes';
drop table test_table; drop table test_table;
set max_recursive_iterations=default;
...@@ -2457,7 +2457,7 @@ static Sys_var_ulong Sys_max_recursive_iterations( ...@@ -2457,7 +2457,7 @@ static Sys_var_ulong Sys_max_recursive_iterations(
"max_recursive_iterations", "max_recursive_iterations",
"Maximum number of iterations when executing recursive queries", "Maximum number of iterations when executing recursive queries",
SESSION_VAR(max_recursive_iterations), CMD_LINE(OPT_ARG), SESSION_VAR(max_recursive_iterations), CMD_LINE(OPT_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(UINT_MAX), BLOCK_SIZE(1)); VALID_RANGE(0, UINT_MAX), DEFAULT(1000), BLOCK_SIZE(1));
static Sys_var_ulong Sys_max_sort_length( static Sys_var_ulong Sys_max_sort_length(
"max_sort_length", "max_sort_length",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment