Commit e0ef5c6d authored by unknown's avatar unknown

Bug#30459 Partitioning across disks failing on Windows

Problem was that there are no support for symlinked files on Windows for
mysqld. So we fail when trying to create them.

Solution: Ignore the DATA/INDEX DIRECTORY clause for partitions and push
a warning. (Just like a MyISAM table)


mysql-test/r/partition.result:
  Bug#30459 Partitioning across disks failing on Windows
  Moved symlink specific tests to partition_symlink
  result file
mysql-test/r/partition_symlink.result:
  Bug#30459 Partitioning across disks failing on Windows
  Moved symlink specific tests from partition.test
  result file
mysql-test/r/partition_windows.result:
  Bug#30459 Partitioning across disks failing on Windows
  result file
mysql-test/t/partition.test:
  Bug#30459 Partitioning across disks failing on Windows
  Moved symlink specific tests to partition_symlink
  test file
mysql-test/t/partition_symlink.test:
  Bug#30459 Partitioning across disks failing on Windows
  Moved symlink specific tests from partition.test
  test file
mysql-test/t/partition_windows.test:
  Bug#30459 Partitioning across disks failing on Windows
  test file
parent 190cc349
...@@ -44,15 +44,6 @@ partition by key(a) ...@@ -44,15 +44,6 @@ partition by key(a)
partitions 1e+300; partitions 1e+300;
ERROR 42000: Only integers allowed as number here near '1e+300' at line 3 ERROR 42000: Only integers allowed as number here near '1e+300' at line 3
create table t1 (a int) create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by list (a) partition by list (a)
(partition p0 values in (1)); (partition p0 values in (1));
create procedure pz() create procedure pz()
...@@ -1207,25 +1198,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified' ...@@ -1207,25 +1198,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
id id
22589 22589
drop table t1, t2; drop table t1, t2;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (c1 varchar(255),c2 tinyint,primary key(c1)) create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
partition by key (c1) partitions 10 ; partition by key (c1) partitions 10 ;
insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1; insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
......
...@@ -81,3 +81,34 @@ Got one of the listed errors ...@@ -81,3 +81,34 @@ Got one of the listed errors
DROP DATABASE mysqltest2; DROP DATABASE mysqltest2;
USE test; USE test;
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
DROP TABLE IF EXISTS `example`; DROP TABLE IF EXISTS t1;
CREATE TABLE `example` ( CREATE TABLE t1 (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT, c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL, c2 varchar(30) NOT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL, c3 smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`ID_EXAMPLE`) PRIMARY KEY (c1)
) ENGINE = MYISAM ) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)( PARTITION BY HASH(c1)(
PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data', PARTITION p0
PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data', DATA DIRECTORY = 'C:/mysqltest/p0Data'
PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data', INDEX DIRECTORY = 'D:/mysqltest/p0Index',
PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data' PARTITION p1,
PARTITION p2
DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
); );
ERROR HY000: Can't create/write to file 'C:\build\5.1\data\partitiontest\p0Data\example#P#p0.MYD' (Errcode: 2) Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
...@@ -78,24 +78,6 @@ create table t1 (a int) ...@@ -78,24 +78,6 @@ create table t1 (a int)
partition by key(a) partition by key(a)
partitions 1e+300; partitions 1e+300;
#
# Bug 21350: Data Directory problems
#
-- error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
#
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
--error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
# #
# Bug 19309 Partitions: Crash if double procedural alter # Bug 19309 Partitions: Crash if double procedural alter
# #
...@@ -1398,35 +1380,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified' ...@@ -1398,35 +1380,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
drop table t1, t2; drop table t1, t2;
#
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
#
disable_query_log;
eval create table t2 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory="$MYSQLTEST_VARDIR/master-data/test/"
index directory="$MYSQLTEST_VARDIR/master-data/test/"
);
enable_query_log;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
show create table t2;
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
# #
# Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table> # Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table>
# #
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
# (DATA/INDEX DIR requires symlinks) # (DATA/INDEX DIR requires symlinks)
-- source include/have_partition.inc -- source include/have_partition.inc
-- source include/have_symlink.inc -- source include/have_symlink.inc
# remove the not_windows line after fixing bug#30459 # remove the not_windows line after fixing bug#33687
# symlinks must also work for files, not only directories
# as in --skip-symbolic-links
-- source include/not_windows.inc -- source include/not_windows.inc
-- disable_warnings -- disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
...@@ -118,4 +120,50 @@ connection default; ...@@ -118,4 +120,50 @@ connection default;
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
disconnect con1; disconnect con1;
#
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
#
disable_query_log;
eval create table t2 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory="$MYSQLTEST_VARDIR/master-data/test/"
index directory="$MYSQLTEST_VARDIR/master-data/test/"
);
enable_query_log;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
show create table t2;
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
#
# Bug 21350: Data Directory problems
#
-- error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
#
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
--error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
...@@ -7,23 +7,34 @@ ...@@ -7,23 +7,34 @@
# #
# Bug 25141: Crash Server on Partitioning command # Bug 25141: Crash Server on Partitioning command
# #
# Bug#30459: Partitioning across disks failing on Windows
# updated this test, since symlinked files are not supported on Windows
# (not the same as symlinked directories that have a special hack
# on windows). This test is not dependent on have_symlink.
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS `example`; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
--disable_abort_on_error CREATE TABLE t1 (
CREATE TABLE `example` ( c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT, c2 varchar(30) NOT NULL,
`DESCRIPTION` varchar(30) NOT NULL, c3 smallint(5) unsigned DEFAULT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL, PRIMARY KEY (c1)
PRIMARY KEY (`ID_EXAMPLE`)
) ENGINE = MYISAM ) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)( PARTITION BY HASH(c1)(
PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data', PARTITION p0
PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data', DATA DIRECTORY = 'C:/mysqltest/p0Data'
PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data', INDEX DIRECTORY = 'D:/mysqltest/p0Index',
PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data' PARTITION p1,
PARTITION p2
DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
); );
--enable_abort_on_error INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
...@@ -794,8 +794,18 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -794,8 +794,18 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
partition_element *part_elem= part_it++; partition_element *part_elem= part_it++;
if (part_elem->engine_type == NULL) if (part_elem->engine_type == NULL)
part_elem->engine_type= default_engine_type; part_elem->engine_type= default_engine_type;
if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) #ifdef HAVE_READLINK
part_elem->data_file_name= part_elem->index_file_name= 0; if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
#endif
{
if (part_elem->data_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"DATA DIRECTORY option ignored");
if (part_elem->index_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"INDEX DIRECTORY option ignored");
part_elem->data_file_name= part_elem->index_file_name= NULL;
}
if (!is_sub_partitioned()) if (!is_sub_partitioned())
{ {
if (check_table_name(part_elem->partition_name, if (check_table_name(part_elem->partition_name,
......
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