1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
# Non-windows specific partition tests.
--source include/not_windows.inc
--source include/have_partition.inc
# DATA DIRECTORY/INDEX DIRECTORY require symbolic link support
--source include/have_symlink.inc
# The test for Bug 20770 is disabled on Windows due to BUG#19107; it
# should be moved into partition.test once the bug has been resolved.
#
# Bug 20770 Partitions: DATA DIRECTORY clause change in reorganize
# doesn't remove old directory
let $MYSQLD_DATADIR= `select @@datadir`;
let $data_directory = DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
let $inx_directory = INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create table t1 (a int) engine myisam
partition by range (a)
subpartition by hash (a)
(partition p0 VALUES LESS THAN (1) $data_directory $inx_directory
(SUBPARTITION subpart00, SUBPARTITION subpart01));
--echo # Checking if file exists before alter
--file_exists $MYSQLD_DATADIR/test/t1.frm
--file_exists $MYSQLD_DATADIR/test/t1.par
--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYD
--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYI
--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYD
--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYI
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(partition p1 VALUES LESS THAN (1) $data_directory $inx_directory
(SUBPARTITION subpart10, SUBPARTITION subpart11),
partition p2 VALUES LESS THAN (2) $data_directory $inx_directory
(SUBPARTITION subpart20, SUBPARTITION subpart21));
--echo # Checking if file exists after alter
--file_exists $MYSQLD_DATADIR/test/t1.frm
--file_exists $MYSQLD_DATADIR/test/t1.par
--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYD
--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYI
--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYD
--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYI
--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYD
--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYI
--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYD
--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYI
drop table t1;
#
# 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/tmp/"
index directory="$MYSQLTEST_VARDIR/tmp/"
);
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#32167: another privilege bypass with DATA/INDEX DIRECTORY
#
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
PARTITION BY KEY (a)
(PARTITION p0 DATA DIRECTORY '$MYSQLD_DATADIR/test');
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
PARTITION BY KEY (a)
(PARTITION p0 INDEX DIRECTORY '$MYSQLD_DATADIR/test');
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
DATA DIRECTORY = '$MYSQLD_DATADIR/test',
SUBPARTITION s0b
DATA DIRECTORY = '$MYSQLD_DATADIR/test'
));
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
INDEX DIRECTORY = '$MYSQLD_DATADIR/test',
SUBPARTITION s0b
INDEX DIRECTORY = '$MYSQLD_DATADIR/test'
));
# End Windows specific test failures.
# These tests contain non-Windows specific directory/file format.
#
# Bug 25141: Crash Server on Partitioning command
#
--disable_warnings
DROP TABLE IF EXISTS `example`;
--enable_warnings
--mkdir $MYSQLTEST_VARDIR/p0Data
--mkdir $MYSQLTEST_VARDIR/p1Data
--mkdir $MYSQLTEST_VARDIR/p2Data
--mkdir $MYSQLTEST_VARDIR/p3Data
--mkdir $MYSQLTEST_VARDIR/p0Index
--mkdir $MYSQLTEST_VARDIR/p1Index
--mkdir $MYSQLTEST_VARDIR/p2Index
--mkdir $MYSQLTEST_VARDIR/p3Index
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval 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`)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p0Data'
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p0Index',
PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p1Data'
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p1Index',
PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p2Data'
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p2Index',
PARTITION p3 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p3Data'
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p3Index'
);
let $MYSQLD_DATADIR= `select @@datadir`;
--echo # Checking that MyISAM .MYD and .MYI are in test db and data/idx dir
--file_exists $MYSQLD_DATADIR/test/example#P#p0.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p0.MYD
--file_exists $MYSQLTEST_VARDIR/p0Data/example#P#p0.MYD
--file_exists $MYSQLTEST_VARDIR/p0Index/example#P#p0.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p1.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p1.MYD
--file_exists $MYSQLTEST_VARDIR/p1Data/example#P#p1.MYD
--file_exists $MYSQLTEST_VARDIR/p1Index/example#P#p1.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p2.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p2.MYD
--file_exists $MYSQLTEST_VARDIR/p2Data/example#P#p2.MYD
--file_exists $MYSQLTEST_VARDIR/p2Index/example#P#p2.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p3.MYI
--file_exists $MYSQLD_DATADIR/test/example#P#p3.MYD
--file_exists $MYSQLTEST_VARDIR/p3Data/example#P#p3.MYD
--file_exists $MYSQLTEST_VARDIR/p3Index/example#P#p3.MYI
DROP TABLE example;
--rmdir $MYSQLTEST_VARDIR/p0Data
--rmdir $MYSQLTEST_VARDIR/p1Data
--rmdir $MYSQLTEST_VARDIR/p2Data
--rmdir $MYSQLTEST_VARDIR/p3Data
--rmdir $MYSQLTEST_VARDIR/p0Index
--rmdir $MYSQLTEST_VARDIR/p1Index
--rmdir $MYSQLTEST_VARDIR/p2Index
--rmdir $MYSQLTEST_VARDIR/p3Index
--error 1
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`)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0 DATA DIRECTORY = '/not/existent/p0Data',
PARTITION p1 DATA DIRECTORY = '/not/existent/p1Data',
PARTITION p2 DATA DIRECTORY = '/not/existent/p2Data',
PARTITION p3 DATA DIRECTORY = '/not/existent/p3Data'
);
|