Repository navigation
fix(migrations): let the 2.1.0 relationship type backfill run on utf8mb3 and latin1 MySQL databases - #37189
Conversation
…mb3 and latin1 MySQL databases
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved🔴 High risk · Converting names enables a persistent relationship-type backfill on utf8mb3 and latin1 databases; incorrect matches could assign wrong IDs in stored data. Converts VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Issue
No issue. Found while testing PR #37150 on a utf8mb3 database. utf8mb3 databases are real, for example on Google Cloud SQL (issue #28255).
Problem
The 2.1.0 MySQL migration cannot finish on a database whose character set is utf8mb3 or latin1. It stops in
postDataMigrationSQLScript.sqlwith:The failing statement links glossary term relationships to their relationship type (added in PR #28042). It compares the two names case-sensitively with:
relationship_type_entityis always utf8mb4. Butentity_relationship.relationTypetakes the database character set, and on a utf8mb3 or latin1 database MySQL cannot apply a utf8mb4 collation to it. 2.1.0 is never recorded, so every latermigratefails at the same place.What this PR changes
One line:
relationTypeis converted to utf8mb4 before the collation is applied.The comparison is still case-sensitive, so the result is the same as before on a utf8mb4 database. 2.1.0 is not released yet, so the statement is fixed in place. A database that already ran it on an rc runs it once more: that is safe, because it sets the same values again and keeps existing ones through
COALESCE.How it was tested
On MySQL 8.0:
entity_relationshipon utf8mb3, latin1,utf8mb4_unicode_ciandutf8mb4_0900_ai_ci: the old one fails on utf8mb3 and latin1; the new one works on all four. With abroaderand aBroaderrow, onlybroadergets linked, as before.openmetadata-ops.sh migrateon a fresh utf8mb3 database: before, it stops at this statement; now it finishes 2.1.0. On that database, the new statement links abroaderrow to its type, and the old one fails.migrateon a freshutf8mb4_0900_ai_cidatabase still finishes 2.1.0.I also checked the other
COLLATE utf8mb4_*uses in 2.1.0 and inTimeSeriesDAOs. They work on utf8mb3: they apply the collation to a utf8mb4 value (an OAuth column, aCAST, or aJSON_TABLEcolumn, which is always utf8mb4).