Add 8.4 and 9.x reserved keywords to the upgrade check - #41
Conversation
The reserved keywords check only knew about words reserved up to 8.0.31, and wasn't registered for any later version, so it missed newer keywords and didn't run at all for upgrades starting past 8.0.31 (e.g. 8.0 to 8.4). Add the words reserved since then -- QUALIFY and TABLESAMPLE (8.4.0), LIBRARY (9.2.0) and EXTERNAL (9.4.0) -- and register the check for those crossings. MANUAL and PARALLEL were reserved in 8.4.0 but nonreserved again in 8.4.11, so add_keywords gains an optional upper-bound version to report them only below 8.4.11. Adds unit tests for the generated keyword list (including the 8.4.11 boundary) and the new registry crossings. This contribution is under the OCA signed by Amazon and covering submissions to the MySQL project.
|
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/ |
|
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: |
|
I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. |
|
Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow |
Description
The upgrade checker's reserved-keywords check reports database objects whose names collide with words that become reserved in the target server version (get_reserved_keywords_check in modules/util/upgrade_checker/upgrade_check_creators.cc). It builds an IN (...) list of keywords via an add_keywords(version, words) helper that includes a set of words only when the upgrade crosses that version, and the check is registered against the same crossing versions (register_reserved in modules/util/upgrade_checker/upgrade_check_registry.cc).
Both the keyword list and the registration stopped at 8.0.31. This caused two problems for upgrades to 8.4 and the 9.x series:
As a result, the objects upgrade fine, but referencing their names unquoted afterward fails on the target (the word is now reserved), and util.checkForServerUpgrade() flagged nothing - so there was no prompt to add backticks or rename before upgrading.
Fix
Add the words reserved since 8.0.31 and register the check for their crossings:
To express the MANUAL/PARALLEL window, add_keywords gains an optional upper-bound version; those words are contributed only for targets below 8.4.11. register_reserved is extended with 8.4.0, 9.2.0 and 9.4.0 so the check is scheduled for those upgrade paths (including 8.0 → 8.4, which previously skipped it). Words that were already reserved on the source server are not re-reported.
Release Notes
Fixed an upgrade-checker issue where objects (schemas, tables, columns, routines, views, triggers, events) whose names match keywords that became reserved in MySQL 8.4 or 9.x — QUALIFY, TABLESAMPLE, LIBRARY, EXTERNAL — were not reported during util.checkForServerUpgrade(). For upgrades from a source newer than 8.0.31 (for example 8.0 to 8.4), the reserved-keywords check was not run at all; it now runs and reports such names so they can be quoted before the upgrade.
Testing
New/updated cases:
unittest/modules/util/upgrade_checker/upgrade_check_creators_t.cc- asserts the generated keyword list per source/target pair: 8.0→8.4.8 includes QUALIFY/TABLESAMPLE/MANUAL/PARALLEL; 8.0→8.4.11 drops MANUAL/PARALLEL (the un-reserved boundary) while keeping QUALIFY/TABLESAMPLE; 8.4.0→9.2.0 adds only LIBRARY; 8.4.0→9.4.0 adds LIBRARY and EXTERNAL; 9.2.0→9.4.0 adds only EXTERNAL (source already reserves LIBRARY).unittest/modules/util/upgrade_checker/upgrade_check_registry_t.cc- extended to assert the check is available for the 8.4.0, 9.2.0 and 9.4.0 crossings and unavailable for ranges that cross none (e.g. 8.4.0→8.4.11), correcting the prior assertion that treated 8.0.31→ as unavailable.Copyright
This contribution is under the OCA signed by Amazon and covering submissions to the MySQL project.