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

mysqlcheck doesn't correctly set default database in repair step

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.1.11
    • N/A
    • Scripts & Clients
    • None

    Description

      How to repeat:

      • create two databases test1 and test2
      • in test1 create a myisam table t1 and insert some data
      • in test2 create a table t2
      • mangle the t1.MYI file so that a REPAIR is needed, e.g. by truncating a few bytes of its end
      • run mysqlcheck --auto-repair --all-databases -v -v -v to get full query output

      Output will be:

      # Connecting to localhost...
      Processing databases
      information_schema
      mysql
      CHECK TABLE `column_stats` 
      mysql.column_stats                                 OK
      [...]
      CHECK TABLE `user` 
      mysql.user                                         OK
      performance_schema
      test
      CHECK TABLE `t1` 
      test.t1
      warning  : Table is marked as crashed
      error    : Size of indexfile is: 2048        Should be: 4096
      error    : Corrupt
      test2
      CHECK TABLE `t2` 
      test2.t2                                           OK
       
      Repairing tables
      REPAIR TABLE `t1` 
      test2.t1
      Error    : Table 'test2.t1' doesn't exist
      status   : Operation failed
      # Disconnecting from localhost...
      

      So mysqlcheck correctly detected that test1.t1 needs to be repaired, then continued to scan database test2. In the repair phase it tried to repair table t1, but it didn't take care to change the default database to t1 or to use a fully qualified table name. So as the last database scanned was test2 this is still the default database for the connection, and REPAIR tries to repair test2.t1, not test1.t1

      Looks as if --all-databases was only added as an afterthought, and not properly tested with tables that actually need a repair?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hholzgra Hartmut Holzgraefe
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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