| 1 |
--source include/have_s3.inc |
| 2 |
--source include/have_sequence.inc |
| 3 |
--source include/have_innodb.inc |
| 4 |
|
| 5 |
# |
| 6 |
# Create unique database for running the tests |
| 7 |
# |
| 8 |
--source create_database.inc |
| 9 |
--disable_warnings |
| 10 |
drop table if exists t1,t2,t3; |
| 11 |
--enable_warnings |
| 12 |
|
| 13 |
--echo # |
| 14 |
--echo # Test ALTER TABLE to and from s3 |
| 15 |
--echo # |
| 16 |
|
| 17 |
create table t1 (a int, b int) engine=aria; |
| 18 |
insert into t1 select seq,seq+10 from seq_1_to_1000; |
| 19 |
alter table t1 engine=s3; |
| 20 |
show create table t1; |
| 21 |
alter table t1 comment="hello"; |
| 22 |
show create table t1; |
| 23 |
alter table t1 engine=aria; |
| 24 |
show create table t1; |
| 25 |
alter table t1 engine=s3; |
| 26 |
alter table t1 engine=innodb; |
| 27 |
show create table t1; |
| 28 |
select count(*), sum(a), sum(b) from t1; |
| 29 |
drop table t1; |
| 30 |
|
| 31 |
--echo # |
| 32 |
--echo # Test ALTER TABLE to and from s3 with rename |
| 33 |
--echo # |
| 34 |
|
| 35 |
create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10; |
| 36 |
alter table t1 rename to t2, engine=s3; |
| 37 |
select count(*), sum(a), sum(b) from t2; |
| 38 |
show create table t2; |
| 39 |
alter table t2 rename to t3, engine=aria; |
| 40 |
show create table t3; |
| 41 |
select count(*), sum(a), sum(b) from t3; |
| 42 |
drop table t3; |
| 43 |
|
| 44 |
--echo # |
| 45 |
--echo # Test changing options for a s3 table |
| 46 |
--echo # |
| 47 |
|
| 48 |
create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_1000; |
| 49 |
alter table t1 engine=s3; |
| 50 |
alter table t1 engine=s3, compression_algorithm="zlib"; |
| 51 |
show create table t1; |
| 52 |
select count(*), sum(a), sum(b) from t1; |
| 53 |
drop table t1; |
| 54 |
|
| 55 |
--echo # |
| 56 |
--echo # Test ALTER TABLE for S3 |
| 57 |
--echo # |
| 58 |
|
| 59 |
create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10; |
| 60 |
alter table t1 add column c int, engine=s3; |
| 61 |
alter table t1 add column d int; |
| 62 |
show create table t1; |
| 63 |
select count(*), sum(a), sum(b), sum(c), sum(d) from t1; |
| 64 |
drop table t1; |
| 65 |
|
| 66 |
--echo # |
| 67 |
--echo # Test ALTER TABLE with locked table for S3 |
| 68 |
--echo # |
| 69 |
|
| 70 |
create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10; |
| 71 |
lock table t1 write; |
| 72 |
alter table t1 add column c int, engine=s3; |
| 73 |
unlock tables; |
| 74 |
select count(*), sum(a), sum(b), sum(c) from t1; |
| 75 |
--error ER_OPEN_AS_READONLY |
| 76 |
lock table t1 write; |
| 77 |
lock table t1 read; |
| 78 |
select count(*), sum(a), sum(b), sum(c) from t1; |
| 79 |
unlock tables; |
| 80 |
drop table t1; |
| 81 |
|
| 82 |
--echo # |
| 83 |
--echo # Test RENAME TABLE |
| 84 |
--echo # |
| 85 |
|
| 86 |
create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10; |
| 87 |
alter table t1 engine=s3; |
| 88 |
rename table t1 to t3; |
| 89 |
alter table t3 rename t2; |
| 90 |
select count(*), sum(a), sum(b) from t2; |
| 91 |
--replace_result $database database |
| 92 |
--error ER_NO_SUCH_TABLE |
| 93 |
select count(*), sum(a), sum(b) from t1; |
| 94 |
drop table t2; |
| 95 |
|
| 96 |
|
| 97 |
--echo # MDEV-31781 ALTER TABLE ENGINE=s3 fails |
| 98 |
create table t (a int) engine=Aria; |
| 99 |
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON |
| 100 |
alter table t engine=S3, algorithm=copy, lock=none; |
| 101 |
|
| 102 |
# |
| 103 |
# clean up |
| 104 |
# |
| 105 |
--source drop_database.inc |