summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/s3/discovery.test
blob: b85776acac517576532006720bd87d6a0eea8256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--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