~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/inc/partition_directory.inc

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
################################################################################
 
2
# inc/partition_directory.inc                                                  #
 
3
#                                                                              #
 
4
# Purpose:                                                                     #
 
5
#   Create and check partitioned tables                                        #
 
6
#   The partitioning function use the column f_int1                            #
 
7
#                                                                              #
 
8
#   For all Data/Index directory combinations                                  #
 
9
#   do                                                                         #
 
10
#     1. Create the partitioned table                                          #
 
11
#     2  Insert the content of the table t0_template into t1                   #
 
12
#     3. Execute inc/partition_check.inc                                       #
 
13
#     4. Drop the table t1                                                     #
 
14
#   done                                                                       #
 
15
#------------------------------------------------------------------------------#
 
16
# Original Author: HH                                                          #
 
17
# Original Date: 2006-05-11                                                    #
 
18
# Change Author:                                                               #
 
19
# Change Date:                                                                 #
 
20
# Change:                                                                      #
 
21
################################################################################
 
22
 
 
23
--disable_warnings
 
24
DROP TABLE IF EXISTS t1;
 
25
--enable_warnings
 
26
 
 
27
let $partitioning= ;
 
28
#----------- PARTITION BY HASH
 
29
if ($with_partitioning)
 
30
{
 
31
let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2;
 
32
if ($with_directories)
 
33
{
 
34
let $partitioning= 
 
35
PARTITION BY HASH(f_int1) PARTITIONS 2
 
36
(PARTITION p1 
 
37
$index_directory,
 
38
PARTITION p2 
 
39
$index_directory);
 
40
}
 
41
}
 
42
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
43
eval CREATE TABLE t1 (
 
44
$column_list
 
45
$unique
 
46
)
 
47
$partitioning;
 
48
eval $insert_all;
 
49
--source suite/parts/inc/partition_check.inc
 
50
DROP TABLE t1;
 
51
--source suite/parts/inc/partition_check_drop.inc
 
52
 
 
53
#----------- PARTITION BY KEY
 
54
if ($with_partitioning)
 
55
{
 
56
let $partitioning= PARTITION BY KEY(f_int1) PARTITIONS 5;
 
57
if ($with_directories)
 
58
{
 
59
let $partitioning= 
 
60
PARTITION BY HASH(f_int1) PARTITIONS 5
 
61
(PARTITION p1
 
62
$data_directory,
 
63
PARTITION p2
 
64
$index_directory,
 
65
PARTITION p3
 
66
$data_directory
 
67
$index_directory,
 
68
PARTITION p4,
 
69
PARTITION p5
 
70
$index_directory);
 
71
}
 
72
}
 
73
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
74
eval CREATE TABLE t1 (
 
75
$column_list
 
76
$unique
 
77
)
 
78
$partitioning;
 
79
eval $insert_all;
 
80
--source suite/parts/inc/partition_check.inc
 
81
DROP TABLE t1;
 
82
--source suite/parts/inc/partition_check_drop.inc
 
83
 
 
84
#----------- PARTITION BY LIST
 
85
if ($with_partitioning)
 
86
{
 
87
let $partitioning= 
 
88
PARTITION BY LIST(MOD(f_int1,4))
 
89
(PARTITION part_3 VALUES IN (-3)
 
90
$index_directory,
 
91
 PARTITION part_2 VALUES IN (-2)
 
92
$data_directory,
 
93
 PARTITION part_1 VALUES IN (-1)
 
94
$data_directory $index_directory,
 
95
 PARTITION part_N VALUES IN (NULL)
 
96
$data_directory,
 
97
 PARTITION part0 VALUES IN (0)
 
98
$index_directory,
 
99
 PARTITION part1 VALUES IN (1)
 
100
,
 
101
 PARTITION part2 VALUES IN (2)
 
102
$data_directory,
 
103
 PARTITION part3 VALUES IN (3)
 
104
$data_directory $index_directory);
 
105
}
 
106
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
107
eval CREATE TABLE t1 (
 
108
$column_list
 
109
$unique
 
110
)
 
111
$partitioning;
 
112
eval $insert_all;
 
113
--source suite/parts/inc/partition_check.inc
 
114
DROP TABLE t1;
 
115
--source suite/parts/inc/partition_check_drop.inc
 
116
 
 
117
#----------- PARTITION BY RANGE
 
118
if ($with_partitioning)
 
119
{
 
120
let $partitioning= PARTITION BY RANGE(f_int1)
 
121
(PARTITION parta VALUES LESS THAN (0)
 
122
$index_directory,
 
123
PARTITION partb VALUES LESS THAN ($max_row_div4)
 
124
$data_directory,
 
125
PARTITION partc VALUES LESS THAN ($max_row_div2)
 
126
$data_directory
 
127
$index_directory,
 
128
PARTITION partd VALUES LESS THAN ($max_row_div2 + $max_row_div4),
 
129
PARTITION parte VALUES LESS THAN ($max_row)
 
130
$data_directory,
 
131
PARTITION partf VALUES LESS THAN $MAX_VALUE
 
132
$index_directory);
 
133
}
 
134
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
135
eval CREATE TABLE t1 (
 
136
$column_list
 
137
$unique
 
138
)
 
139
$partitioning;
 
140
eval $insert_all;
 
141
--source suite/parts/inc/partition_check.inc
 
142
DROP TABLE t1;
 
143
--source suite/parts/inc/partition_check_drop.inc
 
144
 
 
145
#----------- PARTITION BY RANGE -- SUBPARTITION BY HASH
 
146
if ($with_partitioning)
 
147
{
 
148
let $partitioning= 
 
149
PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
 
150
(PARTITION parta VALUES LESS THAN (0)
 
151
$index_directory,
 
152
PARTITION partb VALUES LESS THAN ($max_row_div4)
 
153
$data_directory,
 
154
PARTITION partc VALUES LESS THAN ($max_row_div2),
 
155
PARTITION partd VALUES LESS THAN $MAX_VALUE
 
156
$data_directory
 
157
$index_directory);
 
158
}
 
159
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
160
eval CREATE TABLE t1 (
 
161
$column_list
 
162
$unique
 
163
)
 
164
$partitioning;
 
165
eval $insert_all;
 
166
--source suite/parts/inc/partition_check.inc
 
167
DROP TABLE t1;
 
168
--source suite/parts/inc/partition_check_drop.inc
 
169
 
 
170
#----------- PARTITION BY RANGE -- SUBPARTITION BY KEY
 
171
if ($with_partitioning)
 
172
{
 
173
let $partitioning= PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
 
174
(PARTITION part1 VALUES LESS THAN (0)
 
175
$data_directory
 
176
(SUBPARTITION subpart11, SUBPARTITION subpart12),
 
177
PARTITION part2 VALUES LESS THAN ($max_row_div4)
 
178
$index_directory
 
179
(SUBPARTITION subpart21, SUBPARTITION subpart22),
 
180
PARTITION part3 VALUES LESS THAN ($max_row_div2)
 
181
$data_directory
 
182
$index_directory
 
183
(SUBPARTITION subpart31, SUBPARTITION subpart32),
 
184
PARTITION part4 VALUES LESS THAN $MAX_VALUE
 
185
(SUBPARTITION subpart41, SUBPARTITION subpart42));
 
186
}
 
187
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
188
eval CREATE TABLE t1 (
 
189
$column_list
 
190
$unique
 
191
)
 
192
$partitioning;
 
193
eval $insert_all;
 
194
--source suite/parts/inc/partition_check.inc
 
195
DROP TABLE t1;
 
196
--source suite/parts/inc/partition_check_drop.inc
 
197
 
 
198
#----------- PARTITION BY LIST -- SUBPARTITION BY HASH
 
199
if ($with_partitioning)
 
200
{
 
201
let $partitioning= 
 
202
PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
 
203
(PARTITION part1 VALUES IN (0)
 
204
  $index_directory
 
205
  (SUBPARTITION sp11 
 
206
     $data_directory,
 
207
   SUBPARTITION sp12
 
208
     $index_directory),
 
209
 PARTITION part2 VALUES IN (1)
 
210
  $data_directory
 
211
  (SUBPARTITION sp21 
 
212
     $data_directory,
 
213
   SUBPARTITION sp22
 
214
     $index_directory),
 
215
 PARTITION part3 VALUES IN (2)
 
216
  $data_directory
 
217
  $index_directory
 
218
  (SUBPARTITION sp31, 
 
219
   SUBPARTITION sp32),
 
220
 PARTITION part4 VALUES IN (NULL)
 
221
  (SUBPARTITION sp41 
 
222
     $data_directory
 
223
     $index_directory,
 
224
   SUBPARTITION sp42
 
225
     $data_directory
 
226
     $index_directory));
 
227
}
 
228
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
229
eval CREATE TABLE t1 (
 
230
$column_list
 
231
$unique
 
232
)
 
233
$partitioning;
 
234
eval $insert_all;
 
235
--source suite/parts/inc/partition_check.inc
 
236
DROP TABLE t1;
 
237
--source suite/parts/inc/partition_check_drop.inc
 
238
 
 
239
let $with_directories= FALSE;
 
240