Bug#120948 Add removedLegacyHashingFunctions upgrade check for MySQL 9.7#30
Open
akshatnehra wants to merge 1 commit into
Open
Bug#120948 Add removedLegacyHashingFunctions upgrade check for MySQL 9.7#30akshatnehra wants to merge 1 commit into
akshatnehra wants to merge 1 commit into
Conversation
…9.6+ MD5(), SHA1(), and SHA() were removed from the server binary in MySQL 9.6.0 and moved to component_classic_hashing. Generated columns using these functions become permanently inaccessible after upgrade since loadable functions are disallowed in generated column expressions. This check scans views, routines, triggers, events, generated columns, CHECK constraints, DEFAULT expressions, and functional indexes for usage of these removed functions. Severity is split based on recoverability: - ERROR for generated columns, functional indexes, CHECK constraints, and DEFAULT expressions (blocks upgrade or bricks the table) - WARNING for views, routines, triggers, and events (recoverable post-upgrade by installing component_classic_hashing) The check is registered at version 9.6.0 so it fires for upgrades from 8.4+ to 9.6+. This contribution is under the OCA signed by Amazon and covering submissions to the MySQL project.
|
Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The MySQL Shell upgrade checker (
util.checkForServerUpgrade()) does not detect usage ofMD5(),SHA1(), orSHA()functions in database objects when upgrading from 8.4 to 9.6+. These functions were removed from the server binary in MySQL 9.6.0 and moved tocomponent_classic_hashing.The existing
removedFunctionscheck is registered at version 8.0.11, so its version condition (8.0.11 > 8.4.x) evaluates to false and the check is skipped entirely for 8.4+ source versions. This leaves a gap: if a generated column within any table uses these functions and MySQL server is upgraded to 9.6.0 or later, the table stops working. The server does not re-validate stored generated column expressions during upgrade, andcomponent_classic_hashingcannot help since loadable functions are disallowed in generated column expressions (ERROR 3763). The only recovery path is restoring from a pre-upgrade backup.How to recreate the issue
util.checkForServerUpgrade()targeting 9.7.0:The table is now permanently inaccessible and SELECT, INSERT, ALTER TABLE DROP COLUMN, SHOW CREATE TABLE, and TRUNCATE all fail with ERROR 3763.
Fix
This patch adds a new
removedLegacyHashingFunctionsupgrade check that scans 8 object types for usage of the removed functions: views, stored routines, triggers, events, generated columns (STORED and VIRTUAL), CHECK constraints, DEFAULT expressions, and functional indexes.Severity is split based on recoverability:
component_classic_hashing, or rewritten before upgrading.The check is registered at version
9.6.0so it fires for upgrades from 8.4+ to 9.6+Testing
INSTALL COMPONENT 'file://component_classic_hashing'that confirms WARNING severity.References
This contribution is under the OCA signed by Amazon and covering submissions to the MySQL project.