Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17457

Cannot repair myisam table with mysqlcheck option --use-frm

Details

    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   
      

      Attachments

        Activity

          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.

          elenst Elena Stepanova added a comment - 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.

          People

            serg Sergei Golubchik
            christian.stern Christian Stern
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.