summaryrefslogtreecommitdiff
path: root/mysql-test/suite/archive/discover.test
blob: 0b7e521185d9107a19375c94a71832335984c55e (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
-- source include/have_archive.inc
let $mysqld_datadir= `select @@datadir`;

create table t1 (a int) engine=archive;
show create table t1;
insert t1 values (1);
show tables;

--echo #
--echo # simple discover on use
--echo #
remove_file $mysqld_datadir/test/t1.frm;
flush tables;
insert t1 values (2);
select * from t1;
--list_files $mysqld_datadir/test

--echo #
--echo # show tables
--echo #
create table t2 (a int) engine=archive;
select * from t2;
remove_file $mysqld_datadir/test/t1.frm;
flush tables;
show tables;
--list_files $mysqld_datadir/test

--echo #
--echo # show full tables
--echo #
flush tables;
show full tables;
--list_files $mysqld_datadir/test

--echo #
--echo # discover on truncate
--echo #
flush tables;
--error ER_ILLEGAL_HA
truncate table t1;
--list_files $mysqld_datadir/test

--echo #
--echo # discover on rename
--echo #
remove_file $mysqld_datadir/test/t2.frm;
flush tables;
rename table t2 to t0;
--list_files $mysqld_datadir/test

--echo #
--echo # discover on HA_ERR_TABLE_DEF_CHANGED
--echo #
copy_file $mysqld_datadir/test/t1.ARZ $MYSQL_TMP_DIR/t1.ARZ;
alter table t1 modify a int default 5;
remove_file $mysqld_datadir/test/t1.ARZ;
copy_file $MYSQL_TMP_DIR/t1.ARZ $mysqld_datadir/test/t1.ARZ;
remove_file $MYSQL_TMP_DIR/t1.ARZ;
show create table t1;

--echo #
--echo # discover on drop
--echo #
remove_file $mysqld_datadir/test/t1.frm;
flush tables;
drop table t1;
--list_files $mysqld_datadir/test

--echo #
--echo # discover of table non-existance on drop
--echo #
select * from t0;
remove_file $mysqld_datadir/test/t0.ARZ;
flush tables;
--error ER_NO_SUCH_TABLE
select * from t1;
drop table t0;
--list_files $mysqld_datadir/test
show status like 'Handler_discover';

--echo #
--echo # Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
--echo #

create table t1 (a int) engine=archive;
show create table t1;
insert into t1 values (1);
optimize table t1;
remove_file $mysqld_datadir/test/t1.frm;
flush tables;
insert into t1 values (2);
select * from t1 order by a;
show create table t1;
drop table t1;

--echo #
--echo # BUG#58205 - Valgrind failure in fn_format when called from
--echo #             archive_discover
--echo #
create table `a/../`(a int) engine=archive;
select * from `a/../`; flush tables;
remove_file $mysqld_datadir/test/a@002f@002e@002e@002f.frm;
drop table `a/../`;