Commit e41788d2 authored by Michael Widenius's avatar Michael Widenius

Increased back_log to 150, but not more than max_connections.

- This was done to get better performance when doing a lot of connections.
Ensure that thread_cache_size is not larger than max_connections (trivial optimizations).
Fixed that the --host_cache_size=# startup option works

mysql-test/r/variables.result:
  Increase back_log to 150
sql/hostname.cc:
  Fixed that the --host_cache_size=# startup option works
sql/mysqld.cc:
  Ensure that back_log and thread_cache_size is not set higher than max_connections (as this would not make any sense).
sql/sys_vars.cc:
  Increased back_log to 150
parent 02765f4c
...@@ -1137,12 +1137,12 @@ ERROR HY000: Variable 'ft_stopword_file' is a read only variable ...@@ -1137,12 +1137,12 @@ ERROR HY000: Variable 'ft_stopword_file' is a read only variable
# #
SHOW VARIABLES like 'back_log'; SHOW VARIABLES like 'back_log';
Variable_name Value Variable_name Value
back_log 50 back_log 150
SELECT @@session.back_log; SELECT @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable ERROR HY000: Variable 'back_log' is a GLOBAL variable
SELECT @@global.back_log; SELECT @@global.back_log;
@@global.back_log @@global.back_log
50 150
SET @@session.back_log= 7; SET @@session.back_log= 7;
ERROR HY000: Variable 'back_log' is a read only variable ERROR HY000: Variable 'back_log' is a read only variable
SET @@global.back_log= 7; SET @@global.back_log= 7;
......
select @@global.back_log; select @@global.back_log;
@@global.back_log @@global.back_log
50 150
select @@session.back_log; select @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable ERROR HY000: Variable 'back_log' is a GLOBAL variable
show global variables like 'back_log'; show global variables like 'back_log';
Variable_name Value Variable_name Value
back_log 50 back_log 150
show session variables like 'back_log'; show session variables like 'back_log';
Variable_name Value Variable_name Value
back_log 50 back_log 150
select * from information_schema.global_variables where variable_name='back_log'; select * from information_schema.global_variables where variable_name='back_log';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
BACK_LOG 50 BACK_LOG 150
select * from information_schema.session_variables where variable_name='back_log'; select * from information_schema.session_variables where variable_name='back_log';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
BACK_LOG 50 BACK_LOG 150
set global back_log=1; set global back_log=1;
ERROR HY000: Variable 'back_log' is a read only variable ERROR HY000: Variable 'back_log' is a read only variable
set session back_log=1; set session back_log=1;
......
...@@ -149,7 +149,7 @@ bool hostname_cache_init() ...@@ -149,7 +149,7 @@ bool hostname_cache_init()
Host_entry tmp; Host_entry tmp;
uint key_offset= (uint) ((char*) (&tmp.ip_key) - (char*) &tmp); uint key_offset= (uint) ((char*) (&tmp.ip_key) - (char*) &tmp);
if (!(hostname_cache= new hash_filo(HOST_CACHE_SIZE, if (!(hostname_cache= new hash_filo(host_cache_size,
key_offset, HOST_ENTRY_KEY_SIZE, key_offset, HOST_ENTRY_KEY_SIZE,
NULL, (my_hash_free_key) free, NULL, (my_hash_free_key) free,
&my_charset_bin))) &my_charset_bin)))
......
...@@ -8943,6 +8943,13 @@ static int get_options(int *argc_ptr, char ***argv_ptr) ...@@ -8943,6 +8943,13 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
max_binlog_size_var->option.def_value; max_binlog_size_var->option.def_value;
} }
} }
/* Ensure that some variables are not set higher than needed */
if (back_log > max_connections)
back_log= max_connections;
if (thread_cache_size > max_connections)
thread_cache_size= max_connections;
return 0; return 0;
} }
......
...@@ -364,7 +364,7 @@ static Sys_var_ulong Sys_back_log( ...@@ -364,7 +364,7 @@ static Sys_var_ulong Sys_back_log(
"MySQL can have. This comes into play when the main MySQL thread " "MySQL can have. This comes into play when the main MySQL thread "
"gets very many connection requests in a very short time", "gets very many connection requests in a very short time",
READ_ONLY GLOBAL_VAR(back_log), CMD_LINE(REQUIRED_ARG), READ_ONLY GLOBAL_VAR(back_log), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, 65535), DEFAULT(50), BLOCK_SIZE(1)); VALID_RANGE(1, 65535), DEFAULT(150), BLOCK_SIZE(1));
static Sys_var_charptr Sys_basedir( static Sys_var_charptr Sys_basedir(
"basedir", "Path to installation directory. All paths are " "basedir", "Path to installation directory. All paths are "
......
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