| 1 |
connect con1,localhost,root,,; |
| 2 |
BACKUP STAGE START; |
| 3 |
connection default; |
| 4 |
# |
| 5 |
# Testing with normal tables |
| 6 |
# |
| 7 |
create table t1 (a int) engine=myisam PARTITION BY HASH(a) PARTITIONS 2; |
| 8 |
insert into t1 values (1),(2); |
| 9 |
alter table t1 add column b int; |
| 10 |
alter table t1 rename as t2; |
| 11 |
rename table t2 to t1; |
| 12 |
truncate table t1; |
| 13 |
repair table t1; |
| 14 |
Table Op Msg_type Msg_text |
| 15 |
test.t1 repair status OK |
| 16 |
optimize table t1; |
| 17 |
Table Op Msg_type Msg_text |
| 18 |
test.t1 optimize status OK |
| 19 |
drop table t1; |
| 20 |
create table t1_innodb (a int) engine=innodb PARTITION BY HASH(a) PARTITIONS 2; |
| 21 |
insert into t1_innodb values (1),(2); |
| 22 |
alter table t1_innodb add column b int; |
| 23 |
alter table t1_innodb rename as t2_innodb; |
| 24 |
rename table t2_innodb to t1_innodb; |
| 25 |
truncate table t1_innodb; |
| 26 |
repair table t1_innodb; |
| 27 |
Table Op Msg_type Msg_text |
| 28 |
test.t1_innodb repair status OK |
| 29 |
optimize table t1_innodb; |
| 30 |
Table Op Msg_type Msg_text |
| 31 |
test.t1_innodb optimize note Table does not support optimize, doing recreate + analyze instead |
| 32 |
test.t1_innodb optimize status OK |
| 33 |
drop table t1_innodb; |
| 34 |
# |
| 35 |
# Testing with temporary tables (should not be logged) |
| 36 |
# |
| 37 |
create temporary table tmp_t10 (a int) engine=myisam; |
| 38 |
alter table tmp_t10 add column b int; |
| 39 |
alter table tmp_t10 rename as tmp_t11; |
| 40 |
rename table tmp_t11 to tmp_t10; |
| 41 |
truncate table tmp_t10; |
| 42 |
drop table tmp_t10; |
| 43 |
# |
| 44 |
# Testing with mix of normal and temporary tables |
| 45 |
# |
| 46 |
create temporary table tmp_t20 (a int); |
| 47 |
create table t20 (a int) PARTITION BY HASH(a) PARTITIONS 2; |
| 48 |
drop table tmp_t20,t20; |
| 49 |
create temporary table tmp_t21 (a int); |
| 50 |
create table t21 (a int) PARTITION BY HASH(a) PARTITIONS 2; |
| 51 |
drop temporary table if exists tmp_t21,t21; |
| 52 |
Warnings: |
| 53 |
Note 1051 Unknown table 'test.t21' |
| 54 |
drop table if exists tmp_t21,t21; |
| 55 |
Warnings: |
| 56 |
Note 1051 Unknown table 'test.tmp_t21' |
| 57 |
# |
| 58 |
# Testing create select |
| 59 |
# |
| 60 |
create table t30 (a int) PARTITION BY HASH(a) PARTITIONS 2; |
| 61 |
insert into t30 values (1),(1); |
| 62 |
create table t31 (a int primary key) PARTITION BY HASH(a) PARTITIONS 2 select * from t30 limit 1; |
| 63 |
create or replace table t31 select * from t30 limit 1; |
| 64 |
create or replace temporary table t30_dup select * from t30 limit 1; |
| 65 |
create or replace table t31 (a int primary key) PARTITION BY HASH(a) PARTITIONS 2 select * from t30; |
| 66 |
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
| 67 |
create table t32 (a int) PARTITION BY HASH(a) PARTITIONS 2; |
| 68 |
drop table if exists t30,t31,t32,tmp_t30; |
| 69 |
Warnings: |
| 70 |
Note 1051 Unknown table 'test.t31,test.tmp_t30' |
| 71 |
# |
| 72 |
# Testing create LIKE |
| 73 |
# |
| 74 |
create table t40 (a int) engine=myisam PARTITION BY HASH(a) PARTITIONS 2; |
| 75 |
create table t41 (a int, b int) engine=innodb PARTITION BY HASH(a) PARTITIONS 2; |
| 76 |
create table t42 like t40; |
| 77 |
create or replace table t42 like t41; |
| 78 |
show create table t42; |
| 79 |
Table Create Table |
| 80 |
t42 CREATE TABLE `t42` ( |
| 81 |
`a` int(11) DEFAULT NULL, |
| 82 |
`b` int(11) DEFAULT NULL |
| 83 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 84 |
PARTITION BY HASH (`a`) |
| 85 |
PARTITIONS 2 |
| 86 |
drop table t40, t41, t42; |
| 87 |
# |
| 88 |
# Testing rename |
| 89 |
# |
| 90 |
create table t50 (a int) PARTITION BY HASH(a) PARTITIONS 2; |
| 91 |
create table t51 (a int, b int) PARTITION BY HASH(a) PARTITIONS 2; |
| 92 |
rename table t50 to t52, t51 to t53; |
| 93 |
rename table t52 to tmp, t53 to t52, tmp to t53; |
| 94 |
drop table t52,t53; |
| 95 |
# |
| 96 |
# Testing enable/disable keys |
| 97 |
# |
| 98 |
CREATE TABLE t60 (a int(10), index(a) ) ENGINE=Aria PARTITION BY HASH(a) PARTITIONS 2; |
| 99 |
INSERT INTO t60 VALUES(1),(2),(3); |
| 100 |
ALTER TABLE t60 DISABLE KEYS; |
| 101 |
INSERT INTO t60 VALUES(4),(5),(6); |
| 102 |
ALTER TABLE t60 ENABLE KEYS; |
| 103 |
DROP TABLE t60; |
| 104 |
CREATE TEMPORARY TABLE t61 (i int(10), index(i) ) ENGINE=Aria; |
| 105 |
INSERT INTO t61 VALUES(1),(2),(3); |
| 106 |
ALTER TABLE t61 DISABLE KEYS; |
| 107 |
DROP TABLE t61; |
| 108 |
# |
| 109 |
# Testing load data |
| 110 |
# |
| 111 |
create table t70 (a date, b date, c date not null, d date) engine=aria PARTITION BY HASH(YEAR(a)) PARTITIONS 2; |
| 112 |
load data infile '../../std_data/loaddata1.dat' ignore into table t70 fields terminated by ','; |
| 113 |
load data infile '../../std_data/loaddata1.dat' ignore into table t70 fields terminated by ','; |
| 114 |
truncate table t70; |
| 115 |
lock table t70 write; |
| 116 |
load data infile '../../std_data/loaddata1.dat' ignore into table t70 fields terminated by ','; |
| 117 |
load data infile '../../std_data/loaddata1.dat' ignore into table t70 fields terminated by ','; |
| 118 |
unlock tables; |
| 119 |
create table t71 (a date, b date, c date not null, d date) engine=aria PARTITION BY HASH(YEAR(a)) PARTITIONS 2; |
| 120 |
lock tables t71 write, t70 read; |
| 121 |
insert into t71 select * from t70; |
| 122 |
unlock tables; |
| 123 |
drop table t70,t71; |
| 124 |
# |
| 125 |
# Testing strange table names |
| 126 |
# |
| 127 |
create table `t 1` (a int) PARTITION BY HASH(a) PARTITIONS 2; |
| 128 |
drop table `t 1`; |
| 129 |
# |
| 130 |
# Testing views and triggers |
| 131 |
# |
| 132 |
create table t80 (a int, b int) engine=myisam PARTITION BY HASH(a) PARTITIONS 2; |
| 133 |
create view v1 as select * from t80; |
| 134 |
create trigger trg before insert on t80 for each row set @b:=1; |
| 135 |
drop trigger trg; |
| 136 |
drop view v1; |
| 137 |
drop table t80; |
| 138 |
# |
| 139 |
# Testing alter to a new storage engine |
| 140 |
# |
| 141 |
create table t85 (a int primary key, b int) engine=myisam PARTITION BY HASH(a) PARTITIONS 2; |
| 142 |
alter table t85 engine=innodb; |
| 143 |
drop table t85; |
| 144 |
# |
| 145 |
# Testing backup ddl log for partitioned tables |
| 146 |
# |
| 147 |
CREATE TABLE t200(a INT, b INT) ENGINE ARIA TRANSACTIONAL = 1 PAGE_CHECKSUM = 1; |
| 148 |
INSERT INTO t200 VALUES (5, 5), (15, 15), (25, 25); |
| 149 |
ALTER TABLE t200 PARTITION BY RANGE( a ) ( |
| 150 |
PARTITION p0 VALUES LESS THAN (10), |
| 151 |
PARTITION p1 VALUES LESS THAN (20), |
| 152 |
PARTITION p2 VALUES LESS THAN (30) |
| 153 |
); |
| 154 |
CREATE TABLE t210(a INT, b INT) ENGINE ARIA TRANSACTIONAL = 1 PAGE_CHECKSUM = 1; |
| 155 |
#TODO: echange partitions have not logged yet |
| 156 |
ALTER TABLE t200 EXCHANGE PARTITION p2 WITH TABLE t210; |
| 157 |
ALTER TABLE t200 DROP PARTITION p0; |
| 158 |
ALTER TABLE t200 ADD PARTITION (PARTITION p3 VALUES LESS THAN (40)); |
| 159 |
ALTER TABLE t200 |
| 160 |
REORGANIZE PARTITION p3 INTO ( |
| 161 |
PARTITION n0 VALUES LESS THAN (35), |
| 162 |
PARTITION n1 VALUES LESS THAN (45) |
| 163 |
); |
| 164 |
ALTER TABLE t200 PARTITION BY KEY(a) PARTITIONS 2; |
| 165 |
ALTER TABLE t200 PARTITION BY HASH(a) PARTITIONS 8; |
| 166 |
ALTER TABLE t200 COALESCE PARTITION 4; |
| 167 |
ALTER TABLE t200 |
| 168 |
PARTITION BY RANGE (b) |
| 169 |
SUBPARTITION BY KEY (a) |
| 170 |
SUBPARTITIONS 2 ( |
| 171 |
PARTITION p0 VALUES LESS THAN (10), |
| 172 |
PARTITION p1 VALUES LESS THAN (20), |
| 173 |
PARTITION p2 VALUES LESS THAN (30), |
| 174 |
PARTITION p3 VALUES LESS THAN (MAXVALUE) |
| 175 |
); |
| 176 |
ALTER TABLE t200 REMOVE PARTITIONING; |
| 177 |
DROP TABLE t200, t210; |
| 178 |
# Test for the case when TDC contains TABLE_SHARE object for the |
| 179 |
# certain table, but the table is not opened |
| 180 |
CREATE TABLE t220(a INT) ENGINE ARIA PARTITION BY HASH(a) PARTITIONS 2; |
| 181 |
SELECT VERSION FROM INFORMATION_SCHEMA.tables WHERE |
| 182 |
TABLE_SCHEMA = 'test' AND TABLE_NAME = 't220'; |
| 183 |
DROP TABLE t220; |
| 184 |
# |
| 185 |
# Reading backup ddl log file |
| 186 |
# |
| 187 |
CREATE,MyISAM,1,test,t1,id: 1,,0,,, |
| 188 |
ALTER,MyISAM,1,test,t1,id: 1,MyISAM,1,test,t1,id: 2 |
| 189 |
RENAME,MyISAM,1,test,t1,id: 2,MyISAM,1,test,t2,id: 2 |
| 190 |
RENAME,MyISAM,1,test,t2,id: 2,MyISAM,1,test,t1,id: 2 |
| 191 |
TRUNCATE,MyISAM,1,test,t1,id: 2,,0,,, |
| 192 |
repair,MyISAM,1,test,t1,id: 2,,0,,, |
| 193 |
optimize,MyISAM,1,test,t1,id: 2,,0,,, |
| 194 |
DROP,MyISAM,1,test,t1,id: 2,,0,,, |
| 195 |
CREATE,InnoDB,1,test,t1_innodb,id: 3,,0,,, |
| 196 |
ALTER,InnoDB,1,test,t1_innodb,id: 3,InnoDB,1,test,t1_innodb,id: 4 |
| 197 |
RENAME,InnoDB,1,test,t1_innodb,id: 4,InnoDB,1,test,t2_innodb,id: 4 |
| 198 |
RENAME,InnoDB,1,test,t2_innodb,id: 4,InnoDB,1,test,t1_innodb,id: 4 |
| 199 |
TRUNCATE,InnoDB,1,test,t1_innodb,id: 4,,0,,, |
| 200 |
repair,InnoDB,1,test,t1_innodb,id: 4,,0,,, |
| 201 |
ALTER,InnoDB,1,test,t1_innodb,id: 4,InnoDB,1,test,t1_innodb,id: 5 |
| 202 |
DROP,InnoDB,1,test,t1_innodb,id: 5,,0,,, |
| 203 |
CREATE,MyISAM,1,test,t20,id: 6,,0,,, |
| 204 |
DROP,MyISAM,1,test,t20,id: 6,,0,,, |
| 205 |
CREATE,MyISAM,1,test,t21,id: 7,,0,,, |
| 206 |
DROP,MyISAM,1,test,t21,id: 7,,0,,, |
| 207 |
CREATE,MyISAM,1,test,t30,id: 8,,0,,, |
| 208 |
CREATE,MyISAM,1,test,t31,id: 9,,0,,, |
| 209 |
DROP,MyISAM,1,test,t31,id: 9,,0,,, |
| 210 |
CREATE,MyISAM,0,test,t31,id: 10,,0,,, |
| 211 |
DROP,MyISAM,0,test,t31,id: 10,,0,,, |
| 212 |
DROP_AFTER_CREATE,MyISAM,1,test,t31,id: 11,,0,,, |
| 213 |
CREATE,MyISAM,1,test,t32,id: 12,,0,,, |
| 214 |
DROP,MyISAM,1,test,t30,id: 8,,0,,, |
| 215 |
DROP,MyISAM,1,test,t32,id: 12,,0,,, |
| 216 |
CREATE,MyISAM,1,test,t40,id: 13,,0,,, |
| 217 |
CREATE,InnoDB,1,test,t41,id: 14,,0,,, |
| 218 |
CREATE,partition,0,test,t42,id: 15,,0,,, |
| 219 |
DROP,MyISAM,1,test,t42,id: 15,,0,,, |
| 220 |
CREATE,partition,0,test,t42,id: 16,,0,,, |
| 221 |
DROP,MyISAM,1,test,t40,id: 13,,0,,, |
| 222 |
DROP,InnoDB,1,test,t41,id: 14,,0,,, |
| 223 |
DROP,InnoDB,1,test,t42,id: 16,,0,,, |
| 224 |
CREATE,MyISAM,1,test,t50,id: 17,,0,,, |
| 225 |
CREATE,MyISAM,1,test,t51,id: 18,,0,,, |
| 226 |
RENAME,MyISAM,1,test,t50,id: 17,MyISAM,1,test,t52,id: 17 |
| 227 |
RENAME,MyISAM,1,test,t51,id: 18,MyISAM,1,test,t53,id: 18 |
| 228 |
RENAME,MyISAM,1,test,t52,id: 17,MyISAM,1,test,tmp,id: 17 |
| 229 |
RENAME,MyISAM,1,test,t53,id: 18,MyISAM,1,test,t52,id: 18 |
| 230 |
RENAME,MyISAM,1,test,tmp,id: 17,MyISAM,1,test,t53,id: 17 |
| 231 |
DROP,MyISAM,1,test,t52,id: 18,,0,,, |
| 232 |
DROP,MyISAM,1,test,t53,id: 17,,0,,, |
| 233 |
CREATE,Aria,1,test,t60,id: 19,,0,,, |
| 234 |
CHANGE_INDEX,Aria,1,test,t60,id: 19,,0,,, |
| 235 |
CHANGE_INDEX,Aria,1,test,t60,id: 19,,0,,, |
| 236 |
DROP,Aria,1,test,t60,id: 19,,0,,, |
| 237 |
CREATE,Aria,1,test,t70,id: 20,,0,,, |
| 238 |
BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, |
| 239 |
BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, |
| 240 |
TRUNCATE,Aria,1,test,t70,id: 20,,0,,, |
| 241 |
BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, |
| 242 |
BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, |
| 243 |
CREATE,Aria,1,test,t71,id: 21,,0,,, |
| 244 |
BULK_INSERT,Aria,1,test,t71,id: 21,,0,,, |
| 245 |
BULK_INSERT,Aria,1,test,t71,id: 21,,0,,, |
| 246 |
DROP,Aria,1,test,t70,id: 20,,0,,, |
| 247 |
DROP,Aria,1,test,t71,id: 21,,0,,, |
| 248 |
CREATE,MyISAM,1,test,t@00201,id: 22,,0,,, |
| 249 |
DROP,MyISAM,1,test,t@00201,id: 22,,0,,, |
| 250 |
CREATE,MyISAM,1,test,t80,id: 23,,0,,, |
| 251 |
CREATE,VIEW,0,test,v1,,,0,,, |
| 252 |
CREATE,TRIGGER,0,test,trg,,,0,,, |
| 253 |
DROP,TRIGGER,0,test,trg,,,0,,, |
| 254 |
DROP,VIEW,0,test,v1,,,0,,, |
| 255 |
DROP,MyISAM,1,test,t80,id: 23,,0,,, |
| 256 |
CREATE,MyISAM,1,test,t85,id: 24,,0,,, |
| 257 |
ALTER,MyISAM,1,test,t85,id: 24,InnoDB,1,test,t85,id: 25 |
| 258 |
DROP,InnoDB,1,test,t85,id: 25,,0,,, |
| 259 |
CREATE,Aria,0,test,t200,id: 26,,0,,, |
| 260 |
ALTER,Aria,0,test,t200,id: 26,Aria,1,test,t200,id: 27 |
| 261 |
CREATE,Aria,0,test,t210,id: 28,,0,,, |
| 262 |
EXCHANGE_PARTITION,Aria,1,test,t200,id: 27,Aria,0,test,t210,id: 28 |
| 263 |
ALTER,Aria,1,test,t200,id: 27,Aria,1,test,t200,id: 29 |
| 264 |
ALTER,Aria,1,test,t200,id: 29,Aria,1,test,t200,id: 30 |
| 265 |
ALTER,Aria,1,test,t200,id: 30,Aria,1,test,t200,id: 31 |
| 266 |
ALTER,Aria,1,test,t200,id: 31,Aria,1,test,t200,id: 32 |
| 267 |
ALTER,Aria,1,test,t200,id: 32,Aria,1,test,t200,id: 33 |
| 268 |
ALTER,Aria,1,test,t200,id: 33,Aria,1,test,t200,id: 34 |
| 269 |
ALTER,Aria,1,test,t200,id: 34,Aria,1,test,t200,id: 35 |
| 270 |
ALTER,Aria,1,test,t200,id: 35,Aria,0,test,t200,id: 36 |
| 271 |
DROP,Aria,0,test,t200,id: 36,,0,,, |
| 272 |
DROP,Aria,0,test,t210,id: 28,,0,,, |
| 273 |
CREATE,Aria,1,test,t220,id: 37,,0,,, |
| 274 |
DROP,Aria,1,test,t220,id: 37,,0,,, |
| 275 |
# |
| 276 |
# Cleanup |
| 277 |
# |
| 278 |
disconnect con1; |