Skip to content

Commit 4418aeb

Browse files
committed
Bug#38020526 Set back_log to max_connections if 0
Description: WL#16888 had set the default value of back_log to 10000. It also set the minimum value of back_log to 1 and removed the section which updates the value to max_connections if the value was 0 (the previous default). Issue: This introduces an unexpected change in behavior where back_log would take the value of 1 if the user had explicitly configured it to 0. This causes performance regressions as the value 1 is too small and leads to frequent reconnects. Fix: Allow 0 to be the minimum value and update the value of back_log to max_connections if back_log takes the value 0. Ensure that by default back_log still takes the value 10000. Change-Id: Idc849c1bb73cf824f90fb8a5f2811cc8c54d586f
1 parent 9f40f3e commit 4418aeb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sql/mysqld.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6897,6 +6897,9 @@ int init_common_variables() {
68976897
(host_cache_size = 628 + ((max_connections - 500) / 20)) > 2000)
68986898
host_cache_size = 2000;
68996899

6900+
/* Fix back_log */
6901+
if (back_log == 0 && (back_log = max_connections) > 65535) back_log = 65535;
6902+
69006903
unireg_init(opt_specialflag); /* Set up extern variables */
69016904
while (!(my_default_lc_messages =
69026905
my_locale_by_name(nullptr, lc_messages, strlen(lc_messages)))) {

sql/sys_vars.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ static Sys_var_ulong Sys_back_log(
11231123
"MySQL can have. This comes into play when the main MySQL thread "
11241124
"gets very many connection requests in a very short time",
11251125
READ_ONLY GLOBAL_VAR(back_log), CMD_LINE(REQUIRED_ARG),
1126-
VALID_RANGE(1, 65535), DEFAULT(10000), BLOCK_SIZE(1));
1126+
VALID_RANGE(0, 65535), DEFAULT(10000), BLOCK_SIZE(1));
11271127

11281128
static Sys_var_charptr Sys_basedir(
11291129
"basedir",

0 commit comments

Comments
 (0)