Skip to content
  • Oystein Grovlen's avatar
    cd4d3eac
    Bug#25650399: DOWNGRADE FROM MYSQL 8.0 TO 5.7 WILL CRASH SERVER · cd4d3eac
    Oystein Grovlen authored
    MySQL 8.0 adds a generated column to the two tables mysql.server_cost
    and mysql.engine_cost.  MySQL 5.7 fails if system tables contain
    generated columns.  Hence, downgrade to 5.7 will not work when cost
    tables contain generated columns from 8.0.
    
    This patch is for 5.7 and backports fix to read_cost_constants() from
    8.0.  mysql_system_tables_fix.sql is changed to remove columns
    should they exist.  This will make mysql_upgrade, if run during
    downgrade, restore these tables to its original form.
    
    sql/opt_costconstantcache.cc
       In order for resolving of generated column to work correctly when
       opening cost tables, lex_start() must be called.
    
    scripts/mysql_system_tables_fix.sql
       Add SQL code to remove the columns from 8.0 should they exist.
    
    scripts/mysql_system_tables.sql
       Specify only non-default values in insert statements for cost tables.
       This way mysql_upgrade does not give errors if extra columns exist.
    
    mysql-test/t/opt_costmodel_downgrade.test
    mysql-test/r/opt_costmodel_downgrade.result
       Test to verfiy that 5.7 does not crash should generated columns exist in
       cost tables.  Also verifies that running mysql_upgrade will remove
       the columns.
    
    (cherry picked from commit 6f909b48b8f324079dd9f2a2813312194d17cff1)
    cd4d3eac
    Bug#25650399: DOWNGRADE FROM MYSQL 8.0 TO 5.7 WILL CRASH SERVER
    Oystein Grovlen authored
    MySQL 8.0 adds a generated column to the two tables mysql.server_cost
    and mysql.engine_cost.  MySQL 5.7 fails if system tables contain
    generated columns.  Hence, downgrade to 5.7 will not work when cost
    tables contain generated columns from 8.0.
    
    This patch is for 5.7 and backports fix to read_cost_constants() from
    8.0.  mysql_system_tables_fix.sql is changed to remove columns
    should they exist.  This will make mysql_upgrade, if run during
    downgrade, restore these tables to its original form.
    
    sql/opt_costconstantcache.cc
       In order for resolving of generated column to work correctly when
       opening cost tables, lex_start() must be called.
    
    scripts/mysql_system_tables_fix.sql
       Add SQL code to remove the columns from 8.0 should they exist.
    
    scripts/mysql_system_tables.sql
       Specify only non-default values in insert statements for cost tables.
       This way mysql_upgrade does not give errors if extra columns exist.
    
    mysql-test/t/opt_costmodel_downgrade.test
    mysql-test/r/opt_costmodel_downgrade.result
       Test to verfiy that 5.7 does not crash should generated columns exist in
       cost tables.  Also verifies that running mysql_upgrade will remove
       the columns.
    
    (cherry picked from commit 6f909b48b8f324079dd9f2a2813312194d17cff1)
Loading