Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.1.11
-
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
- relates to
-
MDEV-9440 mysqlcheck -A --auto-repair selects wrong database when trying to repair broken table
- Closed