Commit f4ff086a authored by Arun Kuruvila's avatar Arun Kuruvila

Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO

               PROBLEMS

Description:- Server variable "--lower_case_tables_names"
when set to "0" on windows platform which does not support
case sensitive file operations leads to problems. A warning
message is printed in the error log while starting the
server with "--lower_case_tables_names=0". Also according to
the documentation, seting "lower_case_tables_names" to "0"
on a case-insensitive filesystem might lead to index
corruption.

Analysis:- The problem reported in the bug is:-
Creating an INNODB table 'a' and executing a query, "INSERT
INTO a SELECT a FROM A;" on a server started with
"--lower_case_tables_names=0" and running on a
case-insensitive filesystem leads innodb to flat spin.
Optimizer thinks that "a" and "A" are two different tables
as the variable "lower_case_table_names" is set to "0". As a
result, optimizer comes up with a plan which does not need a
temporary table. If the same table is used in select and
insert, a temporary table is needed. This incorrect
optimizer plan leads to infinite insertions.

Fix:- If the server is started with
"--lower_case_tables_names" set to 0 on a case-insensitive
filesystem, an error, "The server option
'lower_case_table_names'is configured to use case sensitive
table names but the data directory is on a case-insensitive
file system which is an unsupported combination. Please
consider either using a case sensitive file system for your
data directory or switching to a case-insensitive table name
mode.", is printed in the server error log and the server
exits.
parent 75f43c5f
#
# Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
#
call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
DROP TABLE IF EXISTS t1,T1;
CREATE TABLE t1 (a INT);
SELECT * FROM T1;
a
FLUSH TABLES;
DROP TABLE t1;
CREATE TABLE bug29839 (a INT) ENGINE=INNODB;
SELECT * FROM BUG29839;
ERROR 42S02: Table 'test.BUG29839' doesn't exist
DROP TABLE bug29839;
......@@ -2,6 +2,10 @@
# Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE
# WITH FOREIGN KEY CONSTRAINT.
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
-- source include/have_innodb.inc
CREATE TABLE PERSON (
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_sjis.inc
--source include/have_innodb.inc
--character_set sjis
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_ucs2.inc
--source include/have_innodb.inc
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_ujis.inc
--source include/have_innodb.inc
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_utf8.inc
--source include/have_innodb.inc
--disable_warnings
......
#
# Specific tests for case-insensitive file systems
# i.e. lower_case_filesystem=ON
#
-- source include/have_case_insensitive_file_system.inc
# Embedded server does not support restarting.
--source include/not_embedded.inc
--echo #
--echo # Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
--echo #
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
--error 0,1
--remove_file $SEARCH_FILE
#Shutdown the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
#Start the server with --lower_case_table_names=0 in Windows.
--enable_reconnect
--error 1
--exec $MYSQLD_CMD --lower_case_table_names=0 > $SEARCH_FILE 2>&1
#Search for the error messege in the server error log.
let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names but the data directory is on a case-insensitive file system which is an unsupported combination\. Please consider either using a case sensitive file system for your data directory or switching to a case-insensitive table name mode\.;
--source include/search_pattern_in_file.inc
#Restart the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
#Cleanup
--error 0,1
--remove_file $SEARCH_FILE
#
# Test of force of lower-case-table-names=0
# (User has case insensitive file system and wants to preserve case of
# table names)
#
--source include/have_innodb.inc
--source include/have_lowercase0.inc
--source include/have_case_insensitive_file_system.inc
--source include/not_windows.inc
call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
--disable_warnings
DROP TABLE IF EXISTS t1,T1;
--enable_warnings
#
# This is actually an error, but ok as the user has forced this
# by using --lower-case-table-names=0
CREATE TABLE t1 (a INT);
SELECT * FROM T1;
FLUSH TABLES;
DROP TABLE t1;
#
# InnoDB should in this case be case sensitive
# Note that this is not true on windows as no this OS, InnoDB is always
# storing things in lower case.
#
CREATE TABLE bug29839 (a INT) ENGINE=INNODB;
--error ER_NO_SUCH_TABLE
SELECT * FROM BUG29839;
DROP TABLE bug29839;
# End of 4.1 tests
......@@ -3551,13 +3551,14 @@ static int init_common_variables()
{
if (lower_case_table_names_used)
{
if (global_system_variables.log_warnings)
sql_print_warning("\
You have forced lower_case_table_names to 0 through a command-line \
option, even though your file system '%s' is case insensitive. This means \
that you can corrupt a MyISAM table by accessing it with different cases. \
You should consider changing lower_case_table_names to 1 or 2",
mysql_real_data_home);
sql_print_error("The server option 'lower_case_table_names' is "
"configured to use case sensitive table names but the "
"data directory is on a case-insensitive file system "
"which is an unsupported combination. Please consider "
"either using a case sensitive file system for your data "
"directory or switching to a case-insensitive table name "
"mode.");
return 1;
}
else
{
......
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