| 1 |
# Tests for the partition storage engine in connection with the |
| 2 |
# storage engine ARCHIVE. |
| 3 |
# |
| 4 |
# Creation: |
| 5 |
# 2007-10-18 mleich - Move ARCHIVE related sub tests of partition.test to |
| 6 |
# this test. Reason: ARCHIVE is not everytime available. |
| 7 |
# - Minor cleanup |
| 8 |
# |
| 9 |
|
| 10 |
--source include/have_partition.inc |
| 11 |
--source include/have_archive.inc |
| 12 |
|
| 13 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 14 |
|
| 15 |
# |
| 16 |
# Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES |
| 17 |
# |
| 18 |
CREATE TABLE t1 (f1 DATE NOT NULL) |
| 19 |
ENGINE = ARCHIVE PARTITION BY RANGE (TO_DAYS(f1)) |
| 20 |
(partition p1 values less than (733751), |
| 21 |
partition p2 values less than MAXVALUE); |
| 22 |
|
| 23 |
INSERT INTO t1 VALUES(CURRENT_DATE); |
| 24 |
|
| 25 |
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; |
| 26 |
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; |
| 27 |
DROP TABLE t1; |
| 28 |
CREATE TABLE t1 (f1 DATE NOT NULL) |
| 29 |
ENGINE = ARCHIVE; |
| 30 |
INSERT INTO t1 VALUES(CURRENT_DATE); |
| 31 |
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; |
| 32 |
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; |
| 33 |
DROP TABLE t1; |
| 34 |
|
| 35 |
# |
| 36 |
# Bug 17310 Partitions: Bugs with archived partitioned tables |
| 37 |
# |
| 38 |
--disable_warnings |
| 39 |
drop database if exists db99; |
| 40 |
drop table if exists t1; |
| 41 |
--enable_warnings |
| 42 |
|
| 43 |
create database db99; |
| 44 |
use db99; |
| 45 |
create table t1 (a int not null) |
| 46 |
engine=archive |
| 47 |
partition by list (a) |
| 48 |
(partition p0 values in (1), partition p1 values in (2)); |
| 49 |
insert into t1 values (1), (2); |
| 50 |
--replace_regex /Not owner/Operation not permitted/ |
| 51 |
--error ER_CANT_CREATE_TABLE |
| 52 |
create index inx on t1 (a); |
| 53 |
alter table t1 add partition (partition p2 values in (3)); |
| 54 |
alter table t1 drop partition p2; |
| 55 |
use test; |
| 56 |
drop database db99; |
| 57 |
|
| 58 |
create table t1 (f1 integer) engine= ARCHIVE partition by list(f1) |
| 59 |
( |
| 60 |
partition p1 values in (1), |
| 61 |
partition p2 values in (NULL), |
| 62 |
partition p3 values in (2), |
| 63 |
partition p4 values in (3), |
| 64 |
partition p5 values in (4) |
| 65 |
); |
| 66 |
|
| 67 |
insert into t1 values (1),(2),(3),(4),(null); |
| 68 |
select * from t1; |
| 69 |
select * from t1 where f1 < 3; |
| 70 |
drop table t1; |
| 71 |
|
| 72 |
CREATE TABLE t1 ( |
| 73 |
a int not null, |
| 74 |
b int not null, |
| 75 |
c int not null) engine=ARCHIVE |
| 76 |
partition by hash (a + 2) |
| 77 |
partitions 3 |
| 78 |
(partition x1 tablespace ts1, |
| 79 |
partition x2 tablespace ts2, |
| 80 |
partition x3 tablespace ts3); |
| 81 |
|
| 82 |
insert into t1 values (1,1,1); |
| 83 |
insert into t1 values (2,1,1); |
| 84 |
insert into t1 values (3,1,1); |
| 85 |
insert into t1 values (4,1,1); |
| 86 |
insert into t1 values (5,1,1); |
| 87 |
|
| 88 |
select * from t1; |
| 89 |
|
| 90 |
drop table t1; |
| 91 |
|
| 92 |
# |
| 93 |
# Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table) |
| 94 |
# (though reported as InnoDB bug, requires some ARCHIVE tests |
| 95 |
|
| 96 |
create table t1 (a int) engine=archive partition by hash(a); |
| 97 |
show create table t1; |
| 98 |
drop table t1; |
| 99 |
|
| 100 |
CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, |
| 101 |
f1 VARCHAR(25), |
| 102 |
PRIMARY KEY(id)) ENGINE=ARCHIVE |
| 103 |
PARTITION BY RANGE(id) |
| 104 |
SUBPARTITION BY hash(id) subpartitions 2 |
| 105 |
(PARTITION pa1 values less than (10), |
| 106 |
PARTITION pa2 values less than (20), |
| 107 |
PARTITION pa3 values less than (30), |
| 108 |
PARTITION pa4 values less than (40), |
| 109 |
PARTITION pa5 values less than (50), |
| 110 |
PARTITION pa6 values less than (60), |
| 111 |
PARTITION pa7 values less than (70), |
| 112 |
PARTITION pa8 values less than (80), |
| 113 |
PARTITION pa9 values less than (90), |
| 114 |
PARTITION pa10 values less than (100), |
| 115 |
PARTITION pa11 values less than MAXVALUE); |
| 116 |
|
| 117 |
--disable_query_log |
| 118 |
let $n= 100; |
| 119 |
begin; |
| 120 |
while ($n) |
| 121 |
{ |
| 122 |
insert into t1 (f1) values (repeat('a',25)); |
| 123 |
dec $n; |
| 124 |
} |
| 125 |
commit; |
| 126 |
--enable_query_log |
| 127 |
|
| 128 |
show create table t1; |
| 129 |
select count(*) from t1; |
| 130 |
drop table t1; |
| 131 |
|
| 132 |
|
| 133 |
--echo # |
| 134 |
--echo #BUG 18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS |
| 135 |
--echo # CORRUPTS FRM |
| 136 |
|
| 137 |
CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1) |
| 138 |
PARTITIONS 5; |
| 139 |
SHOW CREATE TABLE t1; |
| 140 |
|
| 141 |
--error ER_CANT_CREATE_TABLE |
| 142 |
ALTER TABLE t1 ENGINE= ARCHIVE; |
| 143 |
|
| 144 |
--echo #After the patch, the ENGINE is correctly displayed as MyISAM |
| 145 |
SHOW CREATE TABLE t1; |
| 146 |
|
| 147 |
--echo #Cleanup. |
| 148 |
DROP TABLE t1; |
| 149 |
|
| 150 |
create database mysqltest1; |
| 151 |
create table mysqltest1.t1 (a int not null, b int not null) engine=archive |
| 152 |
partition by list(a) subpartition by hash(b) |
| 153 |
(partition p1 values in (1), |
| 154 |
partition p2 values in (2)); |
| 155 |
drop database mysqltest1; |