mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / repair.test
blobeb2ca7992a6b76bb041f419f056e681986026588
2 # Test of repair table
5 --disable_warnings
6 drop table if exists t1;
7 --enable_warnings
9 create table t1 SELECT 1,"table 1";
10 repair table t1 use_frm;
11 alter table t1 ENGINE=HEAP;
12 repair table t1 use_frm;
13 drop table t1;
16 # disabled keys during repair
18 create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st));
19 insert into t1 values(1, "One");
20 alter table t1 disable keys;
21 show keys from t1;
22 repair table t1 extended;
23 show keys from t1;
24 drop table t1;
27 # non-existent table
28 repair table t1 use_frm;
30 create table t1 engine=myisam SELECT 1,"table 1";
31 flush tables;
32 let $MYSQLD_DATADIR= `select @@datadir`;
33 system echo 1 > $MYSQLD_DATADIR/test/t1.MYI ;
34 repair table t1;
35 repair table t1 use_frm;
36 drop table t1;
39 # BUG#18874 - Setting myisam_repair_threads > 1, index cardinality always 1
41 CREATE TABLE t1(a INT, KEY(a));
42 INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
43 SET myisam_repair_threads=2;
44 REPAIR TABLE t1;
45 SHOW INDEX FROM t1;
46 SET myisam_repair_threads=@@global.myisam_repair_threads;
47 DROP TABLE t1;
50 # BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and
51 #             server hangs on Linux
53 CREATE TABLE t1(a INT);
54 USE mysql;
55 REPAIR TABLE test.t1 USE_FRM;
56 USE test;
57 DROP TABLE t1;
60 # BUG#23175 - MYISAM crash/repair failed during repair
62 CREATE TABLE t1(a CHAR(255), KEY(a));
63 SET myisam_sort_buffer_size=4096;
64 INSERT INTO t1 VALUES
65 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
66 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
67 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
68 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
69 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
70 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
71 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
72 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
73 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
74 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
75 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
76 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
77 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
78 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
79 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
80 ('0'),('0'),('0'),('0'),('0'),('0'),('0');
81 SET myisam_repair_threads=2;
82 REPAIR TABLE t1;
83 SET myisam_repair_threads=@@global.myisam_repair_threads;
84 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
85 DROP TABLE t1;
88 # BUG#31174 - "Repair" command on MyISAM crashes with small 
89 #              myisam_sort_buffer_size
91 CREATE TABLE t1(a CHAR(255), KEY(a));
92 SET myisam_sort_buffer_size=4496;
93 INSERT INTO t1 VALUES
94 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
95 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
96 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
97 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
98 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
99 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
100 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
101 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
102 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
103 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
104 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
105 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
106 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
107 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
108 ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
109 ('0'),('0'),('0'),('0'),('0'),('0'),('0');
110 SET myisam_repair_threads=2;
111 REPAIR TABLE t1;
112 SET myisam_repair_threads=@@global.myisam_repair_threads;
113 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
114 DROP TABLE t1;
116 --echo End of 4.1 tests
119 # BUG#36055 - mysql_upgrade doesn't really 'upgrade' tables
122 --echo # Test with a saved table from 4.1
123 let $MYSQLD_DATADIR= `select @@datadir`;
124 --copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/t1.frm
125 --copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/t1.MYD
126 --copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/t1.MYI
128 --replace_column 12 # 13 #
129 SHOW TABLE STATUS LIKE 't1';
130 SELECT * FROM t1;
132 --echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE
133 CHECK TABLE t1 FOR UPGRADE;
135 --echo # REPAIR old table USE_FRM should fail
136 REPAIR TABLE t1 USE_FRM;
138 --echo # Run REPAIR TABLE to upgrade .frm file
139 REPAIR TABLE t1;
140 --replace_column 12 # 13 #
141 SHOW TABLE STATUS LIKE 't1';
142 SELECT * FROM t1;
144 REPAIR TABLE t1 USE_FRM;
145 SELECT * FROM t1;
147 DROP TABLE t1;
148 # End of 5.0 tests
151 # Bug#18775 - Temporary table from alter table visible to other threads
153 # REPAIR TABLE ... USE_FRM on temporary table crashed the table or server.
154 --disable_warnings
155 DROP TABLE IF EXISTS tt1;
156 --enable_warnings
157 CREATE TEMPORARY TABLE tt1 (c1 INT);
158 REPAIR TABLE tt1 USE_FRM;
159 DROP TABLE tt1;