| 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 |
# use the new (from bug#14326) partitioning format (i.e. multi-line comments) |
| 174 |
let $partitioning= |
| 175 |
/*!50100 PARTITION BY RANGE(f_int1) |
| 176 |
SUBPARTITION BY KEY(f_int1) |
| 177 |
(PARTITION part1 VALUES LESS THAN (0) $data_directory |
| 178 |
(SUBPARTITION subpart11, |
| 179 |
SUBPARTITION subpart12), |
| 180 |
PARTITION part2 VALUES LESS THAN ($max_row_div4) $index_directory |
| 181 |
(SUBPARTITION subpart21, |
| 182 |
SUBPARTITION subpart22), |
| 183 |
PARTITION part3 VALUES LESS THAN ($max_row_div2) $data_directory $index_directory |
| 184 |
(SUBPARTITION subpart31, |
| 185 |
SUBPARTITION subpart32), |
| 186 |
PARTITION part4 VALUES LESS THAN $MAX_VALUE |
| 187 |
(SUBPARTITION subpart41, |
| 188 |
SUBPARTITION subpart42)) */; |
| 189 |
} |
| 190 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 191 |
eval CREATE TABLE t1 ( |
| 192 |
$column_list |
| 193 |
$unique |
| 194 |
) |
| 195 |
$partitioning; |
| 196 |
eval $insert_all; |
| 197 |
--source suite/parts/inc/partition_check.inc |
| 198 |
DROP TABLE t1; |
| 199 |
--source suite/parts/inc/partition_check_drop.inc |
| 200 |
|
| 201 |
#----------- PARTITION BY LIST -- SUBPARTITION BY HASH |
| 202 |
if ($with_partitioning) |
| 203 |
{ |
| 204 |
# use the old (pre bug#14326) format (i.e. one line comment) |
| 205 |
let $partitioning= /*!50100 PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) (PARTITION part1 VALUES IN (0) $index_directory (SUBPARTITION sp11 $data_directory, SUBPARTITION sp12 $index_directory), PARTITION part2 VALUES IN (1) $data_directory (SUBPARTITION sp21 $data_directory, SUBPARTITION sp22 $index_directory), PARTITION part3 VALUES IN (2) $data_directory $index_directory (SUBPARTITION sp31, SUBPARTITION sp32), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 $data_directory $index_directory, SUBPARTITION sp42 $data_directory $index_directory)) */; |
| 206 |
} |
| 207 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 208 |
eval CREATE TABLE t1 ( |
| 209 |
$column_list |
| 210 |
$unique |
| 211 |
) |
| 212 |
$partitioning; |
| 213 |
eval $insert_all; |
| 214 |
--source suite/parts/inc/partition_check.inc |
| 215 |
DROP TABLE t1; |
| 216 |
--source suite/parts/inc/partition_check_drop.inc |
| 217 |
|
| 218 |
let $with_directories= FALSE; |
| 219 |
|