Skip to content
  • Amitabh Das's avatar
    4a92a398
    WL#12413: Move mysql_upgrade client actions into the server · 4a92a398
    Amitabh Das authored
    This WL moves the actions executed by the MySQL upgrade client to the mysqld
    proper.The MySQL server will then have control of when these actions are
    executed, and is not dependent on user to run the mysql_upgrade client.
    
    The mysql_upgrade client still exists, but will return EXIT_ALREADY_UPGRADED
    on normal usage and SUCCESS when used with --force option.
    
    MySQL upgrade client steps in the past
    ======================================
    
    Step 1. Fix mysql schema - the system tables. (Executing
    mysql_system_tables.sql + mysql_system_tables_fix.sql +
    mysql_system_tables_data_fix.sql)
    Step 2. Fix sys schema tables. (Executing mysql_sys_schema.sql)
    Step 3. Running CHECK TABLE on all tables. If the status of any of the tables
    is not "OK", we either REPAIR the tables or ALTER the tables based on the
    response from CHECK TABLE.
    
    New server options
    ==================
    
    --no-upgrade - to abort if upgrade is needed, to avoid accidental upgrades.
    --minimal-upgrade - start a new server on the old data directory, upgrading DD
    but skipping the upgrade of the server.This option will simulate the older
    behaviour of in-place upgrade.
    --force-upgrade - To force run server upgrade sequence.
    
    The new upgrade steps
    =====================
    
    1. If DD version in dd_properties is not the latest, upgrade DD tables.
    2. Set new DD version and server version in dd_properties table and commit.
    3. If server version in dd_properties is not the latest OR server version in
    dd_properties does not match the latest upgraded server version, upgrade system
    tables.
    4. Make a note of the latest upgraded server version in dd_properties table and
    commit.
    
    During in-place upgrade, if DD upgrade goes well, but Server upgrade happens to
    fail, the server exits. Subsequent server starts would attempt an upgrade and
    fail again (provided the server upgrade failure is repeatable) to start since
    the new server version isn't set yet. Now the user is stuck with a data
    directory with newer DD tables but older system tables. And the server would
    not be operational with this data directory.
    
    To help fix this situation, we introduce a new server option to skip server
    upgrade - minimal-upgrade. With this, we will skip the steps 3 and 4 of the new
    upgrade sequence mentioned above. This is the same as the current behaviour of
    in-place upgrade.
    
    We do not want to allow upgrading a server which has been started with
    --minimal-upgrade. This is to make sure that an upgrade is completed
    successfully before moving to a newer version.
    
    Change-Id: Ifce818e7acb5eb0704ba1ebda36e48f83a58b92a
    4a92a398
    WL#12413: Move mysql_upgrade client actions into the server
    Amitabh Das authored
    This WL moves the actions executed by the MySQL upgrade client to the mysqld
    proper.The MySQL server will then have control of when these actions are
    executed, and is not dependent on user to run the mysql_upgrade client.
    
    The mysql_upgrade client still exists, but will return EXIT_ALREADY_UPGRADED
    on normal usage and SUCCESS when used with --force option.
    
    MySQL upgrade client steps in the past
    ======================================
    
    Step 1. Fix mysql schema - the system tables. (Executing
    mysql_system_tables.sql + mysql_system_tables_fix.sql +
    mysql_system_tables_data_fix.sql)
    Step 2. Fix sys schema tables. (Executing mysql_sys_schema.sql)
    Step 3. Running CHECK TABLE on all tables. If the status of any of the tables
    is not "OK", we either REPAIR the tables or ALTER the tables based on the
    response from CHECK TABLE.
    
    New server options
    ==================
    
    --no-upgrade - to abort if upgrade is needed, to avoid accidental upgrades.
    --minimal-upgrade - start a new server on the old data directory, upgrading DD
    but skipping the upgrade of the server.This option will simulate the older
    behaviour of in-place upgrade.
    --force-upgrade - To force run server upgrade sequence.
    
    The new upgrade steps
    =====================
    
    1. If DD version in dd_properties is not the latest, upgrade DD tables.
    2. Set new DD version and server version in dd_properties table and commit.
    3. If server version in dd_properties is not the latest OR server version in
    dd_properties does not match the latest upgraded server version, upgrade system
    tables.
    4. Make a note of the latest upgraded server version in dd_properties table and
    commit.
    
    During in-place upgrade, if DD upgrade goes well, but Server upgrade happens to
    fail, the server exits. Subsequent server starts would attempt an upgrade and
    fail again (provided the server upgrade failure is repeatable) to start since
    the new server version isn't set yet. Now the user is stuck with a data
    directory with newer DD tables but older system tables. And the server would
    not be operational with this data directory.
    
    To help fix this situation, we introduce a new server option to skip server
    upgrade - minimal-upgrade. With this, we will skip the steps 3 and 4 of the new
    upgrade sequence mentioned above. This is the same as the current behaviour of
    in-place upgrade.
    
    We do not want to allow upgrading a server which has been started with
    --minimal-upgrade. This is to make sure that an upgrade is completed
    successfully before moving to a newer version.
    
    Change-Id: Ifce818e7acb5eb0704ba1ebda36e48f83a58b92a
Loading