Skip to content

Commit

Permalink
MDEV-20401: Server incorrectly auto-sets lower_case_file_system value
Browse files Browse the repository at this point in the history
Server auto-sets lower_case_file_system value based on default
datadir's behavior instead of instead of using the directory specified
by the user through the configuration file or command line options.

This patch fixes this problem.
  • Loading branch information
sysprg committed Jul 16, 2020
1 parent 7473e18 commit 4412a46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4538,8 +4538,10 @@ static int init_common_variables()
get corrupted if accesses with names of different case.
*/
DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
if(mysql_real_data_home_ptr == NULL || *mysql_real_data_home_ptr == 0)
mysql_real_data_home_ptr= mysql_real_data_home;
SYSVAR_AUTOSIZE(lower_case_file_system,
test_if_case_insensitive(mysql_real_data_home));
test_if_case_insensitive(mysql_real_data_home_ptr));
if (!lower_case_table_names && lower_case_file_system == 1)
{
if (lower_case_table_names_used)
Expand All @@ -4556,7 +4558,7 @@ static int init_common_variables()
{
if (global_system_variables.log_warnings)
sql_print_warning("Setting lower_case_table_names=2 because file "
"system for %s is case insensitive", mysql_real_data_home);
"system for %s is case insensitive", mysql_real_data_home_ptr);
SYSVAR_AUTOSIZE(lower_case_table_names, 2);
}
}
Expand All @@ -4567,7 +4569,7 @@ static int init_common_variables()
sql_print_warning("lower_case_table_names was set to 2, even though your "
"the file system '%s' is case sensitive. Now setting "
"lower_case_table_names to 0 to avoid future problems.",
mysql_real_data_home);
mysql_real_data_home_ptr);
SYSVAR_AUTOSIZE(lower_case_table_names, 0);
}
else
Expand Down
2 changes: 1 addition & 1 deletion sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ static Sys_var_ulong Sys_connect_timeout(

static Sys_var_charptr Sys_datadir(
"datadir", "Path to the database root directory",
READ_ONLY GLOBAL_VAR(mysql_real_data_home_ptr),
PARSED_EARLY READ_ONLY GLOBAL_VAR(mysql_real_data_home_ptr),
CMD_LINE(REQUIRED_ARG, 'h'), IN_FS_CHARSET, DEFAULT(mysql_real_data_home));

#ifndef DBUG_OFF
Expand Down

0 comments on commit 4412a46

Please sign in to comment.