BUG#45638 - Create temporary table with engine innodb fails
Create temporary InnoDB table fails on case insensitive filesystems, when lower_case_table_names is 2 (e.g. OS X) and temporary directory path contains upper case letters. The problem was that tmpdir prefix was converted to lower case when table was created, but was passed as is when table was opened. Fixed by leaving tmpdir prefix part intact.
This commit is contained in:
parent
f37a5879b4
commit
16c57d9099
6
mysql-test/r/lowercase_mixed_tmpdir_innodb.result
Executable file
6
mysql-test/r/lowercase_mixed_tmpdir_innodb.result
Executable file
@ -0,0 +1,6 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (id int) engine=InnoDB;
|
||||
insert into t1 values (1);
|
||||
create temporary table t2 engine=InnoDB select * from t1;
|
||||
drop temporary table t2;
|
||||
drop table t1;
|
2
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt
Normal file
2
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--lower-case-table-names=2
|
||||
--tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase
|
6
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
Normal file
6
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
Normal file
@ -0,0 +1,6 @@
|
||||
# This test requires a non-lowercase tmpdir directory on a case-sensitive
|
||||
# filesystem.
|
||||
|
||||
d="$MYSQLTEST_VARDIR/tmp/MixedCase"
|
||||
test -d "$d" || mkdir "$d"
|
||||
rm -f "$d"/*
|
12
mysql-test/t/lowercase_mixed_tmpdir_innodb.test
Normal file
12
mysql-test/t/lowercase_mixed_tmpdir_innodb.test
Normal file
@ -0,0 +1,12 @@
|
||||
--source include/have_lowercase2.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (id int) engine=InnoDB;
|
||||
insert into t1 values (1);
|
||||
create temporary table t2 engine=InnoDB select * from t1;
|
||||
drop temporary table t2;
|
||||
drop table t1;
|
@ -1885,12 +1885,42 @@ bool ha_flush_logs(handlerton *db_type)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief make canonical filename
|
||||
|
||||
@param[in] file table handler
|
||||
@param[in] path original path
|
||||
@param[out] tmp_path buffer for canonized path
|
||||
|
||||
@details Lower case db name and table name path parts for
|
||||
non file based tables when lower_case_table_names
|
||||
is 2 (store as is, compare in lower case).
|
||||
Filesystem path prefix (mysql_data_home or tmpdir)
|
||||
is left intact.
|
||||
|
||||
@note tmp_path may be left intact if no conversion was
|
||||
performed.
|
||||
|
||||
@retval canonized path
|
||||
|
||||
@todo This may be done more efficiently when table path
|
||||
gets built. Convert this function to something like
|
||||
ASSERT_CANONICAL_FILENAME.
|
||||
*/
|
||||
const char *get_canonical_filename(handler *file, const char *path,
|
||||
char *tmp_path)
|
||||
{
|
||||
uint i;
|
||||
if (lower_case_table_names != 2 || (file->ha_table_flags() & HA_FILE_BASED))
|
||||
return path;
|
||||
|
||||
for (i= 0; i <= mysql_tmpdir_list.max; i++)
|
||||
{
|
||||
if (is_prefix(path, mysql_tmpdir_list.list[i]))
|
||||
return path;
|
||||
}
|
||||
|
||||
/* Ensure that table handler get path in lower case */
|
||||
if (tmp_path != path)
|
||||
strmov(tmp_path, path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user