diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-07-10 13:40:54 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-11-05 16:24:26 +0100 |
commit | edc9059c31bddfaa5294423dafc6adfd5a3eabc0 (patch) | |
tree | 107053902c92b5f0105828078145a6378120307a | |
parent | 0b1bc4bf76fcb3c63b208c8e1449809e6d492fd2 (diff) | |
download | mariadb-git-bb-10.2-MDEV-18027.tar.gz |
MDEV-18027: Running out of file descriptors and eventual crashbb-10.2-MDEV-18027
For automatic number of opened files limit take into account number of table instances for table cache
-rw-r--r-- | mysql-test/r/mysqld--help.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/host_cache_size_auto.result | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 17 |
3 files changed, 16 insertions, 5 deletions
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 8bdf994f908..00329328eb0 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1519,7 +1519,7 @@ sysdate-is-now FALSE table-cache 421 table-definition-cache 400 table-open-cache 421 -table-open-cache-instances 8 +table-open-cache-instances 1 tc-heuristic-recover OFF thread-cache-size 151 thread-pool-idle-timeout 60 diff --git a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result index a0a849c1d7a..a9a683e017b 100644 --- a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result +++ b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result @@ -1,3 +1,3 @@ select @@global.host_cache_size; @@global.host_cache_size -632 +653 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 34e5704bcfe..9907c17ee07 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4432,7 +4432,7 @@ static int init_common_variables() min_connections= 10; /* MyISAM requires two file handles per table. */ wanted_files= (extra_files + max_connections + extra_max_connections + - tc_size * 2); + tc_size * 2 * tc_instances); #if defined(HAVE_POOL_OF_THREADS) && !defined(__WIN__) // add epoll or kevent fd for each threadpool group, in case pool of threads is used wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size; @@ -4462,13 +4462,24 @@ static int init_common_variables() sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); /* + If we required too much tc_instances than we reduce it but not more + then in half + */ + SYSVAR_AUTOSIZE_IF_CHANGED(tc_instances, + (uint32) MY_MIN(MY_MAX((files - extra_files - + max_connections)/ + 2/tc_size, + 1), + tc_instances), + uint32); + /* If we have requested too much file handles than we bring max_connections in supported bounds. Still leave at least 'min_connections' connections */ SYSVAR_AUTOSIZE_IF_CHANGED(max_connections, (ulong) MY_MAX(MY_MIN(files- extra_files- - min_tc_size*2, + min_tc_size*2*tc_instances, max_connections), min_connections), ulong); @@ -4481,7 +4492,7 @@ static int init_common_variables() */ SYSVAR_AUTOSIZE_IF_CHANGED(tc_size, (ulong) MY_MIN(MY_MAX((files - extra_files - - max_connections) / 2, + max_connections) / 2 / tc_instances, min_tc_size), tc_size), ulong); DBUG_PRINT("warning", |