Commit 4454c9cd authored by Mattias Jonsson's avatar Mattias Jonsson

Bug#37402: Mysql cant read partitioned table with capital letter in the name

Problem was that ha_partition had HA_FILE_BASED flag set
(since it uses a .par file), but after open it uses the first partitions
flags, which results in different case handling for create and for
open.

Solution was to change the underlying partition name so it was consistent.
(Only happens when lower_case_table_names = 2, i.e. Mac OS X and storage
engines without HA_FILE_BASED, like InnoDB and Memory.)

(Recommit after adding rename of check_lowercase_names to
get_canonical_filename, and moved it from handler.h to mysql_priv.h)

NOTE: if a mixed case name for a partitioned table was created when
lower_case_table_name = 2 it should be renamed or dropped before using
the updated version (See bug#37402 for more info)

mysql-test/include/have_case_insensitive_file_system.inc:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Added include file.
mysql-test/include/have_lowercase0.inc:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  moved case insensitive file system to a new file, leaving only
  lower_case_table_names.
mysql-test/include/have_lowercase2.inc:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Added include file.
mysql-test/lib/mtr_report.pl:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Removed a duplicate row and suppressed warning about setting
  lower_case_table_names to 2 on case sensitive file systems.
mysql-test/r/case_insensitive_file_system.require:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Added requirement file.
mysql-test/r/lowercase0.require:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  moved case insensitive file system to a new file, leaving only
  lower_case_table_names.
mysql-test/suite/parts/inc/partition_mgm.inc:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New include file for testing partitioning management functions for different
  settings of lower_case_table_names.
mysql-test/suite/parts/r/partition_mgm_lc0_archive.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_memory.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_ndb.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_archive.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_memory.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_ndb.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_archive.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_memory.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_ndb.result:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New result file.
mysql-test/suite/parts/t/partition_mgm_lc0_archive.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_innodb.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_memory.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_myisam.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_ndb.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_archive-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_archive.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_innodb-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_innodb.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_memory-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_memory.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_myisam-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_myisam.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_ndb-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_ndb.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_archive-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_archive.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_innodb-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_innodb.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_memory-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_memory.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_myisam-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_myisam.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_ndb-master.opt:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_ndb.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  New test file.
mysql-test/t/lowercase_table3.test:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Moved case sensitive file system to a specific inc-file instead of
  included in lowercase0.inc
sql/ha_partition.cc:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Problem was that ha_partition had HA_FILE_BASED set
  (since it uses a .par file), but after open it uses the first partitions
  table_flags(), which results in different case handling for create and for
  open.
  
  Solution was to change the underlying partition name so it was consistent.
  (Only happens when lower_case_table_names = 2, i.e. Mac OS X)
sql/handler.cc:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Renamed check_lowercase_names to get_canonical_filename, and exported it
  so that ha_partition.cc can use the function.
sql/mysql_priv.h:
  Bug#37402: Mysql cant read partitioned table with capital letter in the name
  
  Renamed check_lowercase_names to get_canonical_filename, and exported it
  so that ha_partition.cc can use the function.
parent ec9572ac
--require r/case_insensitive_file_system.require
--disable_query_log
show variables like "lower_case_file_system";
--enable_query_log
--require r/lowercase0.require
--disable_query_log
show variables like "lower_case_%";
show variables like "lower_case_table_names";
--enable_query_log
--require r/lowercase2.require
--disable_query_log
show variables like 'lower_case_table_names';
--enable_query_log
......@@ -327,7 +327,6 @@ sub mtr_report_stats ($) {
/Sort aborted/ or
/Time-out in NDB/ or
/One can only use the --user.*root/ or
/Setting lower_case_table_names=2/ or
/Table:.* on (delete|rename)/ or
/You have an error in your SQL syntax/ or
/deprecated/ or
......@@ -402,7 +401,15 @@ sub mtr_report_stats ($) {
)) or
# Test case for Bug#31590 produces the following error:
/Out of sort memory; increase server sort buffer size/
/Out of sort memory; increase server sort buffer size/ or
# lowercase_table3 using case sensitive option on
# case insensitive filesystem (InnoDB error).
/Cannot find or open table test\/BUG29839 from/ or
# When trying to set lower_case_table_names = 2
# on a case sensitive file system. Bug#37402.
/lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
)
{
next; # Skip these lines
......
Variable_name Value
lower_case_file_system ON
Variable_name Value
lower_case_file_system ON
lower_case_table_names 0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Creating database MySQL_TEST_DB
CREATE DATABASE MySQL_Test_DB;
USE MySQL_Test_DB;
# 1.0 KEY partitioning mgm
# Creating KEY partitioned table
CREATE TABLE TableA (a INT)
ENGINE = 'NDBCluster'
PARTITION BY KEY (a)
(PARTITION parta ,
PARTITION partB ,
PARTITION Partc ,
PARTITION PartD );
INSERT INTO TableA VALUES (1), (2), (7), (8), (9), (10);
INSERT INTO TableA VALUES (3), (4), (5), (6), (11), (12);
SELECT * FROM TableA;
a
1
10
11
12
2
3
4
5
6
7
8
9
# Test of ADD/COALESCE PARTITIONS
# expecting duplicate partition name
ALTER TABLE TableA ADD PARTITION
(PARTITION partA,
PARTITION Parta,
PARTITION PartA);
ERROR HY000: Duplicate partition name parta
ALTER TABLE TableA ADD PARTITION
(PARTITION partE,
PARTITION Partf,
PARTITION PartG);
SELECT * FROM TableA;
a
1
10
11
12
2
3
4
5
6
7
8
9
SHOW CREATE TABLE TableA;
Table Create Table
TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION parta ENGINE = ndbcluster, PARTITION partB ENGINE = ndbcluster, PARTITION Partc ENGINE = ndbcluster, PARTITION PartD ENGINE = ndbcluster, PARTITION partE ENGINE = ndbcluster, PARTITION Partf ENGINE = ndbcluster, PARTITION PartG ENGINE = ndbcluster) */
ALTER TABLE TableA COALESCE PARTITION 4;
SELECT * FROM TableA;
a
1
10
11
12
2
3
4
5
6
7
8
9
SHOW CREATE TABLE TableA;
Table Create Table
TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION parta ENGINE = ndbcluster, PARTITION partB ENGINE = ndbcluster, PARTITION Partc ENGINE = ndbcluster) */
# Test of REORGANIZE PARTITIONS
# Should not work on HASH/KEY
ALTER TABLE TableA REORGANIZE PARTITION parta,partB,Partc INTO
(PARTITION PARTA ,
PARTITION partc );
ERROR HY000: REORGANISE PARTITION can only be used to reorganise partitions not to change their numbers
ALTER TABLE TableA REORGANIZE PARTITION parta,Partc INTO
(PARTITION partB ,
PARTITION parta );
ERROR HY000: When reorganising a set of partitions they must be in consecutive order
ALTER TABLE TableA REORGANIZE PARTITION parta,partB INTO
(PARTITION partB COMMENT="Previusly named parta",
PARTITION parta COMMENT="Previusly named partB");
SELECT * FROM TableA;
a
1
10
11
12
2
3
4
5
6
7
8
9
SHOW CREATE TABLE TableA;
Table Create Table
TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION partB COMMENT = 'Previusly named parta' ENGINE = ndbcluster, PARTITION parta COMMENT = 'Previusly named partB' ENGINE = ndbcluster, PARTITION Partc ENGINE = ndbcluster) */
# Test of RENAME TABLE
RENAME TABLE TableA to TableB;
SELECT * FROM TableB;
a
1
10
11
12
2
3
4
5
6
7
8
9
RENAME TABLE TableB to TableA;
SELECT * FROM TableA;
a
1
10
11
12
2
3
4
5
6
7
8
9
# Checking name comparision Upper vs Lower case
# Error if lower_case_table_names != 0
# lower_case_table_names: 0
# Test of REMOVE PARTITIONING
ALTER TABLE TableA REMOVE PARTITIONING;
SELECT * FROM TableA;
a
1
10
11
12
2
3
4
5
6
7
8
9
SHOW CREATE TABLE TableA;
Table Create Table
TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
# Cleaning up after KEY PARTITIONING test
DROP TABLE TableA;
# Cleaning up before exit
USE test;
DROP DATABASE MySQL_Test_DB;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
################################################################################
# t/partition_mgm_lc0_archive.test #
# #
# Purpose: #
# Test of partitioning management functions (incl upper/lower case names): #
# Archive branch + lower_case_table_names = 0 #
# (usually Unix like, apart from Mac OS X) #
# Also requires lower_case_file_system OFF #
# #
#------------------------------------------------------------------------------#
# Original Author: mattiasj #
# Original Date: 2008-06-27 #
################################################################################
# The server must support partitioning.
--source include/have_partition.inc
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
--source include/have_lowercase0.inc
--source include/have_case_sensitive_file_system.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
let $have_bug37719= 1;
##### Storage engine to be tested
--source include/have_archive.inc
let $engine= 'Archive';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mgm.inc
################################################################################
# t/partition_mgm_lc0_innodb.test #
# #
# Purpose: #
# Test of partitioning management functions (incl upper/lower case names): #
# InnoDB branch + lower_case_table_names = 0 #
# (usually Unix like, apart from Mac OS X) #
# Also requires lower_case_file_system OFF #
# #
#------------------------------------------------------------------------------#
# Original Author: mattiasj #
# Original Date: 2008-06-27 #
################################################################################
# The server must support partitioning.
--source include/have_partition.inc
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
--source include/have_lowercase0.inc
--source include/have_case_sensitive_file_system.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mgm.inc
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
################################################################################
# t/partition_mgm_lc1_archive.test #
# #
# Purpose: #
# Test of partitioning management functions (incl upper/lower case names): #
# Archive branch + lower_case_table_names = 1 (usually Windows) #
# #
#------------------------------------------------------------------------------#
# Original Author: mattiasj #
# Original Date: 2008-06-27 #
################################################################################
# The server must support partitioning.
--source include/have_partition.inc
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
--source include/have_lowercase1.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_archive.inc
let $engine= 'Archive';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mgm.inc
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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