summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/partition.result28
-rw-r--r--mysql-test/r/partition_symlink.result31
-rw-r--r--mysql-test/r/partition_windows.result40
-rw-r--r--mysql-test/t/partition.test47
-rw-r--r--mysql-test/t/partition_symlink.test50
-rw-r--r--mysql-test/t/partition_windows.test37
-rw-r--r--sql/partition_info.cc14
7 files changed, 144 insertions, 103 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index a361a8f6bcc..161337ae8a6 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -44,15 +44,6 @@ partition by key(a)
partitions 1e+300;
ERROR 42000: Only integers allowed as number here near '1e+300' at line 3
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 p0 values in (1));
create procedure pz()
@@ -1207,25 +1198,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
id
22589
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))
partition by key (c1) partitions 10 ;
insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result
index 20e841d2e0e..8b55124d7eb 100644
--- a/mysql-test/r/partition_symlink.result
+++ b/mysql-test/r/partition_symlink.result
@@ -81,3 +81,34 @@ Got one of the listed errors
DROP DATABASE mysqltest2;
USE test;
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'
diff --git a/mysql-test/r/partition_windows.result b/mysql-test/r/partition_windows.result
index 1fc9e2ba254..c2d4054deeb 100644
--- a/mysql-test/r/partition_windows.result
+++ b/mysql-test/r/partition_windows.result
@@ -1,14 +1,30 @@
-DROP TABLE IF EXISTS `example`;
-CREATE TABLE `example` (
-`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
-`DESCRIPTION` varchar(30) NOT NULL,
-`LEVEL` smallint(5) unsigned DEFAULT NULL,
-PRIMARY KEY (`ID_EXAMPLE`)
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
+c2 varchar(30) NOT NULL,
+c3 smallint(5) unsigned DEFAULT NULL,
+PRIMARY KEY (c1)
) ENGINE = MYISAM
-PARTITION BY HASH(ID_EXAMPLE)(
-PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data',
-PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data',
-PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data',
-PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data'
+PARTITION BY HASH(c1)(
+PARTITION p0
+DATA DIRECTORY = 'C:/mysqltest/p0Data'
+ INDEX DIRECTORY = 'D:/mysqltest/p0Index',
+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;
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 23d6c5f8865..183b348d473 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -79,24 +79,6 @@ partition by key(a)
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
#
create table t1 (a int)
@@ -1399,35 +1381,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
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>
#
create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test
index ab779ec2b68..ec809a34090 100644
--- a/mysql-test/t/partition_symlink.test
+++ b/mysql-test/t/partition_symlink.test
@@ -2,7 +2,9 @@
# (DATA/INDEX DIR requires symlinks)
-- source include/have_partition.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
-- disable_warnings
DROP TABLE IF EXISTS t1;
@@ -118,4 +120,50 @@ connection default;
DROP USER mysqltest_1@localhost;
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');
diff --git a/mysql-test/t/partition_windows.test b/mysql-test/t/partition_windows.test
index a0723feac44..d42a7383c99 100644
--- a/mysql-test/t/partition_windows.test
+++ b/mysql-test/t/partition_windows.test
@@ -7,23 +7,34 @@
#
# 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
-DROP TABLE IF EXISTS `example`;
+DROP TABLE IF EXISTS t1;
--enable_warnings
---disable_abort_on_error
-CREATE TABLE `example` (
- `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `DESCRIPTION` varchar(30) NOT NULL,
- `LEVEL` smallint(5) unsigned DEFAULT NULL,
- PRIMARY KEY (`ID_EXAMPLE`)
+CREATE TABLE t1 (
+ c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
+ c2 varchar(30) NOT NULL,
+ c3 smallint(5) unsigned DEFAULT NULL,
+ PRIMARY KEY (c1)
) ENGINE = MYISAM
-PARTITION BY HASH(ID_EXAMPLE)(
-PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data',
-PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data',
-PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data',
-PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data'
+PARTITION BY HASH(c1)(
+ PARTITION p0
+ DATA DIRECTORY = 'C:/mysqltest/p0Data'
+ INDEX DIRECTORY = 'D:/mysqltest/p0Index',
+ 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;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 3b580422da1..16433497efd 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -794,8 +794,18 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
partition_element *part_elem= part_it++;
if (part_elem->engine_type == NULL)
part_elem->engine_type= default_engine_type;
- if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
- part_elem->data_file_name= part_elem->index_file_name= 0;
+#ifdef HAVE_READLINK
+ 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 (check_table_name(part_elem->partition_name,