Skip to content

Fixes #28255: Pin MySQL charset and migrate Flowable tables - #33659

Merged
yan-3005 merged 8 commits into
mainfrom
belo-horizonte
Sep 28, 2026
Merged

yan-3005 merged 8 commits into
mainfrom
belo-horizonte

Conversation

@harshach

@harshach harshach commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #28255

Pins the OpenMetadata MySQL database default to utf8mb4 for fresh installs and upgrades. The upgrade also aligns all Flowable ACT_* tables as one foreign-key-connected set while preserving the session's FOREIGN_KEY_CHECKS, preventing legacy utf8mb3 schemas from failing during restore.

Type of change:

  • Bug fix

High-level design:

  • Set utf8mb4_unicode_ci explicitly in the MySQL bootstrap scripts and current native migration.
  • Run a MySQL-only data migration that detects charset or collation drift and converts every Flowable table to its canonical utf8mb4_0900_ai_ci collation.
  • Preserve and restore the original session foreign-key setting, leave non-Flowable tables untouched, and make aligned schemas a no-op on replay.
  • Convert the complete ACT_* family because changing only one side of a string foreign key is rejected by MySQL.

Tests:

Use cases covered

  • Fresh MySQL databases receive an explicit utf8mb4 default.
  • Existing utf8mb3 Flowable tables with foreign keys migrate successfully without weakening the constraints.
  • Replays are no-ops, partial collation drift is repaired, and non-Flowable tables remain unchanged.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added: FlowableCharsetMigrationTest.java, FlowableCharsetMigrationMySqlTest.java
  • Coverage: targeted suite passed all 9 tests; coverage was not measured separately.

Backend integration tests

  • Not applicable (no backend API changes).
  • MySQL behavior is covered by the Testcontainers regression test above.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Ran mvn -pl openmetadata-service -Dtest=IngestionPipelineMigrationEntryPointTest,FlowableCharsetMigrationTest,FlowableCharsetMigrationMySqlTest test against MySQL 8; all 9 tests passed.
  2. Ran mvn -pl openmetadata-service spotless:check, git diff --check, and make harness-check successfully.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

Open workspace in Conductor

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because the charset work remains attached to an already-applied migration version and the mock-oriented tests still violate an explicit repository testing requirement.

Findings

  1. P1 Applied migration modified ▶
  2. P2 Tests Assert Mock Wiring ▶
Summary

This PR pins fresh MySQL databases to utf8mb4_unicode_ci and adds a MySQL migration hook that aligns Flowable ACT_* tables while preserving the session’s foreign-key-check setting.

  • Updates MySQL bootstrap scripts with an explicit database charset and collation.
  • Converts the connected Flowable table family when charset or collation drift is detected.
  • Adds MySQL Testcontainers coverage for conversion, foreign-key enforcement, replay, drift repair, and isolation of non-Flowable tables.
  • No new issue was introduced since the previous review, but two unresolved repository-rule findings remain.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Run MySQL 2.1.0 data migration] --> B[Query ACT_* table metadata]
    B --> C{Any charset or collation drift?}
    C -- No --> D[No-op]
    C -- Yes --> E[Read session FOREIGN_KEY_CHECKS]
    E --> F[Disable foreign-key checks]
    F --> G[Convert every selected ACT_* table]
    G --> H[Restore original session setting]
    H --> I[Continue remaining data migrations]
Loading

Reviews (5) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

@harshach
harshach requested review from a team, akash-jain-10 and tutte as code owners September 20, 2026 07:19
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 805 → 805
- 0 added, 0 removed, 1 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/src/generated/entity/data/topic.ts

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

# Conflicts:
#	bootstrap/sql/migrations/native/2.1.0/mysql/schemaChanges.sql
@sonarqubecloud

Copy link
Copy Markdown

Comment thread docker/mysql/mysql-script.sql Resolved
yan-3005 and others added 2 commits September 28, 2026 15:17
Align OpenMetadata database defaults and Flowable table conversions with the existing MySQL 8 schema collation. This avoids mixed-collation joins while upgrading legacy utf8mb3 tables.
@gitar-bot

gitar-bot Bot commented Sep 28, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Database upgrades convert connected Flowable tables and change schema collation defaults

Pins MySQL databases to utf8mb4_unicode_ci and adds a data migration that aligns all Flowable ACT_* tables to canonical collation when drift is detected, preserving session foreign-key settings and leaving non-Flowable tables untouched. DB default collation divergence from Flowable tables has been resolved.

✅ 1 closed
✅ Quality: DB default collation diverges from Flowable table collation

📄 bootstrap/sql/migrations/native/2.1.0/mysql/schemaChanges.sql:375 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/FlowableCharsetMigration.java:24 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/FlowableCharsetMigration.java:52 📄 docker/mysql/mysql-script.sql:1
This PR pins the openmetadata_db default to utf8mb4_unicode_ci (bootstrap scripts and the ALTER DATABASE in schemaChanges.sql) but the migration forces every ACT_* table to utf8mb4_0900_ai_ci. Because the two collations differ, any ACT_* table Flowable creates later (e.g. during a Flowable engine schema upgrade) inherits the database default utf8mb4_unicode_ci and diverges from the already-converted 0900_ai_ci tables; the one-shot data migration will not re-run to repair it, so a new string foreign key between an old and new ACT_* table could be rejected by MySQL — the exact failure mode this PR set out to fix. Consider converting Flowable tables to utf8mb4_unicode_ci to match the pinned database default, or documenting why 0900_ai_ci is deliberately chosen for the ACT_* family despite the divergent database default.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL: openmetadata_db should be created with explicit utf8mb4 charset to prevent FK incompatibility on upgraded instances

4 participants