Uncertain redo‑log flush status and upgrade consistency after interrupted mysql_upgrade
0 reputation · 12 Mar 2024, 08:02 UTC
0 reputation · 12 Mar 2024, 08:02 UTC
When a mysql_upgrade operation is terminated unexpectedly, it is unclear whether InnoDB’s redo‑log entries have been fully flushed before crash‑recovery begins.
The upgrade utility may consider partially upgraded tables as still requiring changes, and foreign‑key constraints remain enabled, creating ambiguity about data integrity.
How can we verify that all redo‑log entries are flushed prior to the upgrade ending? Is there a reliable way to confirm that mysql_upgrade’s version‑check logic accurately reflects the true upgrade state? Should foreign‑key constraints be disabled manually during recovery, or can they remain enabled safely?
35275 reputation · 12 Mar 2024, 13:47 UTC
You cannot verify a fully flushed redo log from mysql_upgrade, and redo-log flush state is not proof that an upgrade finished. After an interruption, restart MySQL cleanly, let InnoDB crash recovery complete, then re-run the upgrade check for your installed version. Keep foreign_key_checks enabled; do not disable it during recovery.
mysql_upgrade runs upgrade SQL as ordinary transactions. InnoDB flushes redo at commit according to innodb_flush_log_at_trx_commit and checkpoints dirty pages independently. If the server or utility is interrupted, uncommitted work is rolled back on restart and committed work is reconciled by crash recovery. Crash recovery does not re-run mysql_upgrade logic and does not validate foreign keys.
mysql_upgrade has no output or status meaning “redo log fully flushed.”mysql_upgrade applies to older series, while MySQL 8.0.16+ performs upgrade tasks at startup and the standalone utility is deprecated or absent depending on release.mysql -u root -p -e "SELECT VERSION();"If the server will not start, inspect the error log first.
kill -9; use a normal shutdown or service restart, for example mysqladmin -u root -p shutdownthen start the service.
mysql -u root -p -e "SHOW ENGINE INNODB STATUS\G"and compare “Log sequence number” with “Log flushed up to.” Equality indicates redo durability so far; it does not prove mysql_upgrade completed.
mysql_upgrade on older series, or restart and let the server perform upgrade tasks on MySQL 8.0.16+. If it reports no remaining actions, the upgrade state is consistent.foreign_key_checks=1 enabled. Do not set it to 0 during recovery.Assumes InnoDB is used for the upgraded system tables and the server can restart cleanly. If innodb_flush_log_at_trx_commit is not 1, up to about one second of committed redo may be lost on crash, but recovery remains consistent; this does not change the steps. If recovery does not complete or the upgrade check still reports required actions after a clean re-run, stop and collect the error log before forcing changes.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.