From 83dfeb2435535579a9a9955f7173d633bb6ce78d Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Apr 2010 14:47:18 +0300 Subject: [PATCH] Bug #47095: Can't open_files_limit really be larger than 65535? Several problems addressed: 1. The maximum value for --open_files_limit on non-windows boxes is now raised to UINT_MAX (the maximum possible without significant changes in the code). The maximum value on windows is kept to be 2048 due to a known limitation (bug 24509). 2. mysqld_safe now supports --open_files_limit=xx in addition to --open-files-limit=xx 3. mysqld_safe always passes through --open[_-]files[_-]limit to the underlying mysqld. It used to pass it through only if it the user running the script has access to the root directory or there was an --user argument specified. 4. Fixed a prototype in my_file.c to match its counterpart in the other #ifdef branch. --- include/my_global.h | 2 +- mysys/my_file.c | 2 +- scripts/mysqld_safe.sh | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 779152203be..e4e53aca20a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -751,7 +751,7 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif #define MY_NFILE 64 /* This is only used to save filenames */ #ifndef OS_FILE_LIMIT -#define OS_FILE_LIMIT 65535 +#define OS_FILE_LIMIT UINT_MAX #endif /* #define EXT_IN_LIBNAME */ diff --git a/mysys/my_file.c b/mysys/my_file.c index 44bacf55307..d37da975c37 100644 --- a/mysys/my_file.c +++ b/mysys/my_file.c @@ -72,7 +72,7 @@ static uint set_max_open_files(uint max_file_limit) } #else -static int set_max_open_files(uint max_file_limit) +static uint set_max_open_files(uint max_file_limit) { /* We don't know the limit. Return best guess */ return min(max_file_limit, OS_FILE_LIMIT); diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 23b5efcaf2b..e4e5f1a1510 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -183,6 +183,7 @@ parse_arguments() { ;; --nice=*) niceness="$val" ;; --open-files-limit=*) open_files="$val" ;; + --open_files_limit=*) open_files="$val" ;; --skip-kill-mysqld*) KILL_MYSQLD=0 ;; --syslog) want_syslog=1 ;; --skip-syslog) want_syslog=0 ;; @@ -397,10 +398,14 @@ then if test -n "$open_files" then ulimit -n $open_files - append_arg_to_args "--open-files-limit=$open_files" fi fi +if test -n "$open_files" +then + append_arg_to_args "--open-files-limit=$open_files" +fi + safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}} # Make sure that directory for $safe_mysql_unix_port exists mysql_unix_port_dir=`dirname $safe_mysql_unix_port`