diff options
author | Daniel Black <daniel@mariadb.org> | 2021-03-30 09:38:34 +1100 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2021-03-30 10:07:08 +1100 |
commit | 831adb1e5cf5d283a5a727b396ecf75a5b207699 (patch) | |
tree | 1a7654f3695830459a877c67b25740ad43287eda | |
parent | 2ad61c678243dec2a808b1f67b5760a725163052 (diff) | |
download | mariadb-git-831adb1e5cf5d283a5a727b396ecf75a5b207699.tar.gz |
MDEV-17239 default max_recursive_iterations 4G -> 1000bb-10.6-danielblack-MDEV-17239-default-max_recursive_iterations-1k
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.
-rw-r--r-- | mysql-test/main/mysqld--help.result | 2 | ||||
-rw-r--r-- | mysql-test/main/win_big-mdev-11697.result | 2 | ||||
-rw-r--r-- | mysql-test/main/win_big-mdev-11697.test | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 2 |
4 files changed, 6 insertions, 2 deletions
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 141ef94ad59..25e49ddc29b 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1605,7 +1605,7 @@ max-join-size 18446744073709551615 max-length-for-sort-data 1024 max-password-errors 18446744073709551615 max-prepared-stmt-count 16382 -max-recursive-iterations 18446744073709551615 +max-recursive-iterations 1000 max-relay-log-size 1073741824 max-rowid-filter-size 131072 max-seeks-for-key 18446744073709551615 diff --git a/mysql-test/main/win_big-mdev-11697.result b/mysql-test/main/win_big-mdev-11697.result index ec9d2243c88..e8034e67aaf 100644 --- a/mysql-test/main/win_big-mdev-11697.result +++ b/mysql-test/main/win_big-mdev-11697.result @@ -1,3 +1,4 @@ +set max_recursive_iterations=200000; 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) select id, random_data, 42, 'Hello' @@ -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 SORT_MERGE_PASSES WITH PASSES drop table test_table; +set max_recursive_iterations=default; diff --git a/mysql-test/main/win_big-mdev-11697.test b/mysql-test/main/win_big-mdev-11697.test index 7103b8522be..9488a938554 100644 --- a/mysql-test/main/win_big-mdev-11697.test +++ b/mysql-test/main/win_big-mdev-11697.test @@ -1,3 +1,4 @@ +set max_recursive_iterations=200000; 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) @@ -48,3 +49,4 @@ from information_schema.session_status where variable_name like 'Sort_merge_passes'; drop table test_table; +set max_recursive_iterations=default; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 8b73484cb8a..b72d4a3c358 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2457,7 +2457,7 @@ static Sys_var_ulong Sys_max_recursive_iterations( "max_recursive_iterations", "Maximum number of iterations when executing recursive queries", 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( "max_sort_length", |