1call mtr.add_suppression("character set is multi-byte"); 2drop table if exists t1; 3create table t1 SELECT 1,"table 1"; 4repair table t1 use_frm; 5Table Op Msg_type Msg_text 6test.t1 repair warning Number of rows changed from 0 to 1 7test.t1 repair status OK 8alter table t1 ENGINE=HEAP; 9repair table t1 use_frm; 10Table Op Msg_type Msg_text 11test.t1 repair note The storage engine for the table doesn't support repair 12drop table t1; 13create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st)); 14insert into t1 values(1, "One"); 15alter table t1 disable keys; 16show keys from t1; 17Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment 18t1 0 PRIMARY 1 id A 1 NULL NULL BTREE 19t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled 20repair table t1 extended; 21Table Op Msg_type Msg_text 22test.t1 repair status OK 23show keys from t1; 24Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment 25t1 0 PRIMARY 1 id A 1 NULL NULL BTREE 26t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled 27drop table t1; 28repair table t1 use_frm; 29Table Op Msg_type Msg_text 30test.t1 repair Error Table 'test.t1' doesn't exist 31test.t1 repair status Operation failed 32create table t1 engine=myisam SELECT 1,"table 1"; 33flush tables; 34repair table t1; 35Table Op Msg_type Msg_text 36test.t1 repair Error Incorrect file format 't1' 37test.t1 repair error Corrupt 38repair table t1 use_frm; 39Table Op Msg_type Msg_text 40test.t1 repair warning Number of rows changed from 0 to 1 41test.t1 repair status OK 42drop table t1; 43CREATE TABLE t1(a INT, KEY(a)); 44INSERT INTO t1 VALUES(1),(2),(3),(4),(5); 45SET myisam_repair_threads=2; 46REPAIR TABLE t1; 47Table Op Msg_type Msg_text 48test.t1 repair status OK 49SHOW INDEX FROM t1; 50Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment 51t1 1 a 1 a A 5 NULL NULL YES BTREE 52SET myisam_repair_threads=@@global.myisam_repair_threads; 53DROP TABLE t1; 54CREATE TABLE t1(a INT); 55USE mysql; 56REPAIR TABLE test.t1 USE_FRM; 57Table Op Msg_type Msg_text 58test.t1 repair status OK 59USE test; 60DROP TABLE t1; 61CREATE TABLE t1(a CHAR(255), KEY(a)); 62SET myisam_sort_buffer_size=4096; 63INSERT INTO t1 VALUES 64('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 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'); 80Warnings: 81Error 1034 myisam_sort_buffer_size is too small. X 82Warning 1034 Number of rows changed from 0 to 157 83SET myisam_repair_threads=2; 84REPAIR TABLE t1; 85Table Op Msg_type Msg_text 86test.t1 repair error myisam_sort_buffer_size is too small. X 87test.t1 repair warning Number of rows changed from 0 to 157 88test.t1 repair status OK 89SET myisam_repair_threads=@@global.myisam_repair_threads; 90SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; 91DROP TABLE t1; 92CREATE TABLE t1(a CHAR(255), KEY(a)); 93SET myisam_sort_buffer_size=4496; 94INSERT INTO t1 VALUES 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'),('0'),('0'),('0'), 110('0'),('0'),('0'),('0'),('0'),('0'),('0'); 111SET myisam_repair_threads=2; 112REPAIR TABLE t1; 113Table Op Msg_type Msg_text 114test.t1 repair status OK 115SET myisam_repair_threads=@@global.myisam_repair_threads; 116SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; 117DROP TABLE t1; 118# End of 4.1 tests 119# Test with a saved table from 4.1 120SHOW TABLE STATUS LIKE 't1'; 121Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary 122t1 MyISAM 9 Fixed 2 5 10 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL 17179868160 N 123SELECT * FROM t1; 124id 1251 1262 127# Run CHECK TABLE, it should indicate table need a REPAIR TABLE 128CHECK TABLE t1 FOR UPGRADE; 129Table Op Msg_type Msg_text 130test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! 131# REPAIR old table USE_FRM should fail 132REPAIR TABLE t1 USE_FRM; 133Table Op Msg_type Msg_text 134test.t1 repair warning Number of rows changed from 0 to 1 135test.t1 repair status OK 136# Run REPAIR TABLE to upgrade .frm file 137REPAIR TABLE t1; 138Table Op Msg_type Msg_text 139test.t1 repair status OK 140SHOW TABLE STATUS LIKE 't1'; 141Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary 142t1 MyISAM 10 Fixed 1 7 7 1970324836974591 1024 0 NULL # # NULL latin1_swedish_ci NULL 17179868160 N 143SELECT * FROM t1; 144id 1451 146REPAIR TABLE t1 USE_FRM; 147Table Op Msg_type Msg_text 148test.t1 repair warning Number of rows changed from 0 to 1 149test.t1 repair status OK 150SELECT * FROM t1; 151id 1521 153DROP TABLE t1; 154# End of 5.0 tests 155DROP TABLE IF EXISTS tt1; 156CREATE TEMPORARY TABLE tt1 (c1 INT); 157REPAIR TABLE tt1 USE_FRM; 158Table Op Msg_type Msg_text 159tt1 repair error Cannot repair temporary table from .frm file 160DROP TABLE tt1; 161# 162# Bug #48248 assert in MDL_ticket::upgrade_shared_lock_to_exclusive 163# 164DROP TABLE IF EXISTS t1; 165CREATE TABLE t1(a INT); 166LOCK TABLES t1 READ; 167REPAIR TABLE t1; 168Table Op Msg_type Msg_text 169test.t1 repair Error Table 't1' was locked with a READ lock and can't be updated 170test.t1 repair status Operation failed 171UNLOCK TABLES; 172DROP TABLE t1; 173# 174# Test for bug #50784 "MDL: Assertion `m_tickets.is_empty() || 175# m_tickets.front() == m_trans_sentinel'" 176# 177drop tables if exists t1, t2; 178create table t1 (i int); 179create table t2 (j int); 180set @@autocommit= 0; 181repair table t1, t2; 182Table Op Msg_type Msg_text 183test.t1 repair status OK 184test.t2 repair status OK 185set @@autocommit= default; 186drop tables t1, t2; 187# 188# Check that we have decent error messages when using crashed 189# .frm file from MySQL 3.23 190# 191# Test with a saved table from 3.23 192SET @save_global_character_set_server= @@global.character_set_server; 193set @@global.character_set_server=@@character_set_server; 194select count(*) from t1; 195ERROR HY000: Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM 196check table t1; 197Table Op Msg_type Msg_text 198test.t1 check Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM 199test.t1 check error Corrupt 200repair table t1; 201Table Op Msg_type Msg_text 202test.t1 repair Error Got error 190 "Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump an" from storage engine MyISAM 203test.t1 repair error Corrupt 204repair table t1 use_frm; 205Table Op Msg_type Msg_text 206test.t1 repair status OK 207select count(*) from t1; 208count(*) 2090 210check table t1; 211Table Op Msg_type Msg_text 212test.t1 check status OK 213drop table t1; 214set @@global.character_set_server=@save_global_character_set_server; 215create table t1 (a blob); 216create view v1 as select * from t1; 217repair view v1; 218Table Op Msg_type Msg_text 219test.v1 repair status OK 220drop view v1; 221drop table t1; 222# End of 5.5 tests 223CREATE TABLE t1 (i INT) ENGINE=MyISAM; 224INSERT t1 VALUES (1); 225LOCK TABLE t1 WRITE; 226REPAIR TABLE t1; 227Table Op Msg_type Msg_text 228test.t1 repair status OK 229SELECT * FROM INFORMATION_SCHEMA.TABLES; 230SELECT * FROM t1; 231i 2321 233UNLOCK TABLES; 234DROP TABLE t1; 235# End of 10.0 tests 236create table t1 (a int, b varchar(200)); 237insert t1 select seq, repeat(200, seq) from seq_1_to_30; 238delete from t1 where a % 13 = 0; 239repair table t1 use_frm; 240Table Op Msg_type Msg_text 241test.t1 repair warning Number of rows changed from 0 to 28 242test.t1 repair status OK 243delete from t1 where a % 11 = 0; 244repair table t1 extended use_frm; 245Table Op Msg_type Msg_text 246test.t1 repair warning Number of rows changed from 0 to 26 247test.t1 repair status OK 248delete from t1 where a % 7 = 0; 249set myisam_repair_threads = 2; 250repair table t1 use_frm; 251Table Op Msg_type Msg_text 252test.t1 repair warning Number of rows changed from 0 to 22 253test.t1 repair status OK 254set myisam_repair_threads = default; 255drop table t1; 256# End of 10.2 tests 257