Skip to content

[2.1] Fix hard delete failing on MySQL with 'Illegal mix of collations' in FQN cleanup (#38443) - #38444

Merged
yan-3005 merged 2 commits into
2.1from
backport/2.1-fqn-cleanup-union-collation
Nov 23, 2026
Merged

yan-3005 merged 2 commits into
2.1from
backport/2.1-fqn-cleanup-union-collation

Conversation

@yan-3005

@yan-3005 yan-3005 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #38449

Backport of #38443 to 2.1.

2.1 has the same FqnKeyedRowCleanup UNION probe (from #38126 through #38229), so a hard delete on a MySQL server whose default collation is not utf8mb4_0900_ai_ci fails with Illegal mix of collations for operation 'UNION'. On MySQL each probe now selects CONVERT(<hash> USING utf8mb4) COLLATE utf8mb4_bin; the WHERE clause keeps the bare column and its index. Postgres unchanged, no schema change.

Clean cherry-pick. FqnKeyedRowCleanupTest on this branch: Tests run: 14, Failures: 0, Errors: 0.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue was found.

Summary

Fixes MySQL hard-delete probes by selecting hashes with a shared collation. PostgreSQL SQL and lookup conditions stay unchanged.

  • MySQL hard deletes now combine hash probes across mixed collations.

Reviews (6) · Last reviewed commit: "Run the FQN-cleanup probes on a real MyS..." · Reviewed by Greptile

The hard-delete cleanup from #38126 probes every taggable entity table in
one UNION ALL. MySQL rejects a UNION whose columns have different
collations, and an install's hash columns do not share one: most are
ascii_bin, the newer tables declare utf8mb4_0900_ai_ci, and
query_entity.fqnHash (renamed in 1.2.0 without a collation) takes the
server default. On a server whose default is not utf8mb4_0900_ai_ci,
every hard delete of a taggable entity fails with
"Illegal mix of collations for operation 'UNION'".

On MySQL each probe now selects CONVERT(hash USING utf8mb4) COLLATE
utf8mb4_bin. The WHERE clause still reads the bare column, so the lookup
keeps its index. No schema change.

(cherry picked from commit 4f9ccf8)
@yan-3005
yan-3005 requested a review from a team as a code owner November 23, 2026 08:28
@yan-3005
yan-3005 requested review from IceS2 and removed request for a team November 23, 2026 08:28
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

The SQL-string test cannot catch the collation error. This one starts
MySQL with utf8mb4_unicode_ci as the server default and three tables on
the collations an install mixes (ascii_bin, utf8mb4_0900_ai_ci, server
default). The bare-column union fails with 'Illegal mix of collations';
the namesake and nested probes return the hash from every table.

(cherry picked from commit 5316487)
@yan-3005
yan-3005 merged commit 8e59ba1 into 2.1 Nov 23, 2026
46 of 50 checks passed
@yan-3005
yan-3005 deleted the backport/2.1-fqn-cleanup-union-collation branch November 23, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants