• Jon Olav Hauglid's avatar
    Bug #11755431 (former 47205) · 984988cf
    Jon Olav Hauglid authored
    MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR ENGINES NOT
    SUPPORTING NATIVE REPAIR
    
    Executing 'mysqlcheck --check-upgrade --auto-repair ...' will first issue
    'CHECK TABLE FOR UPGRADE' for all tables in the database in order to check if the
    tables are compatible with the current version of MySQL. Any tables that are
    found incompatible are then upgraded using 'REPAIR TABLE'.
    
    The problem was that some engines (e.g. InnoDB) do not support 'REPAIR TABLE'.
    This caused any such tables to be left incompatible. As a result such tables were
    not properly fixed by the mysql_upgrade tool.
    
    This patch fixes the problem by first changing 'CHECK TABLE FOR UPGRADE' to return
    a different error message if the engine does not support REPAIR. Instead of
    "Table upgrade required. Please do "REPAIR TABLE ..." it will report
    "Table rebuild required. Please do "ALTER TABLE ... FORCE ..."
    
    Second, the patch changes mysqlcheck to do 'ALTER TABLE ... FORCE' instead of
    'REPAIR TABLE' in these cases.
    
    This patch also fixes 'ALTER TABLE ... FORCE' to actually rebuild the table.
    This change should be reflected in the documentation. Before this patch,
    'ALTER TABLE ... FORCE' was unused (See Bug#11746162)
    
    Test case added to mysqlcheck.test
    984988cf
mysqlcheck.test 9.21 KB