[MDEV-17457] Cannot repair myisam table with mysqlcheck option --use-frm Created: 2018-10-15  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Server, Storage Engine - MyISAM
Affects Version/s: 5.5, 10.0, 10.1, 10.0.30, 10.3.9, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Christian Stern Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: myisam, repair
Environment:

Linux or Windows server



 Description   

With mysqlcheck -r --use-frm database table it should be possible to repair a myisam table even if the MYI file is corrupted.

CREATE  TABLE IF NOT EXISTS `testdb`.`t1` (
  `Idx` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
  PRIMARY KEY (`Idx`))
ENGINE = MYISAM
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_german1_ci
COMMENT = 'test table';

mysqlcheck -ce testdb t1
testdb.t1                                   OK
 
rm t1.MYI
mysqlcheck -ce testdb t1
Failed to SHOW CREATE TABLE `t1`
Error: Can't find file: './testdb/t1.MYI' (errno: 2 "No such file or directory")
 
mysqlcheck -r --use-frm testdb t1
Failed to SHOW CREATE TABLE `t1`
Error: Can't find file: './testdb/t1.MYI' (errno: 2 "No such file or directory")

mysql --database=testdb  --execute="REPAIR TABLE t1 USE_FRM"
+------------------+--------+----------+------------------------------------+
| Table            | Op     | Msg_type | Msg_text                           |
+------------------+--------+----------+------------------------------------+
| testdb.t1 | repair | warning  | Number of rows changed from 0 to 6 |
| testdb.t1 | repair | status   | OK                                 |
+------------------+--------+----------+------------------------------------+

mysqlcheck -ce testdb t1
testdb.t1   



 Comments   
Comment by Elena Stepanova [ 2018-11-19 ]

It can actually be repaired, if a table name is omitted and the operation is performed for the whole schema. The reason is that when the table name is provided, the tool issues SHOW CREATE TABLE for it (to define whether it's a view) and chokes on this failing statement.

Generated at Thu Feb 08 08:36:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.