mariadb/mysql-test/suite/s3/discovery.test
Monty ab38b7511b MDEV-17841 S3 storage engine
A read-only storage engine that stores it's data in (aws) S3

To store data in S3 one could use ALTER TABLE:
ALTER TABLE table_name ENGINE=S3

libmarias3 integration done by Sergei Golubchik
libmarias3 created by Andrew Hutchings
2019-05-23 02:28:23 +03:00

84 lines
1.9 KiB
Text

--source include/have_s3.inc
--source include/have_sequence.inc
#
# Create unique database for running the tests
#
--source create_database.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
let $datadir=`select @@datadir`;
--echo #
--echo # Test discovery of s3
--echo #
create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
alter table t1 engine=s3;
--echo #
--echo # Check discovery by select
--echo #
--remove_file $datadir/$database/t1.frm
flush tables;
select * from t1 limit 1;
--echo #
--echo # Check if changes to .frm is copied to S3
--echo #
alter table t1 change column b c int not null;
flush tables;
--remove_file $datadir/$database/t1.frm
select * from t1 limit 1;
--echo #
--echo # Check if SHOW TABLES finds the S3 tables
--echo #
create table t2 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
alter table t2 engine=s3;
flush tables;
--remove_file $datadir/$database/t1.frm
--replace_result $database database
SHOW TABLES;
drop table t2;
--echo #
--echo # Check if DROP TABLE works with discovery
--echo #
select count(*) from t1;
flush tables;
--remove_file $datadir/$database/t1.frm
drop table t1;
--replace_result $database database
--error ER_NO_SUCH_TABLE
select count(*), sum(a) from t1;
--echo #
--echo # Check if S3 detects that the .frm is too old
--echo #
create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
alter table t1 engine=s3;
--copy_file $datadir/$database/t1.frm $datadir/$database/t1.frm-old
alter table t1 add column c int, engine=s3;
flush tables;
--remove_file $datadir/$database/t1.frm
--copy_file $datadir/$database/t1.frm-old $datadir/$database/t1.frm
--remove_file $datadir/$database/t1.frm-old
select * from t1 limit 1;
flush tables;
--remove_file $datadir/$database/t1.frm
select * from t1 limit 1;
drop table t1;
#
# clean up
#
--source drop_database.inc