Skip to content

fix: add information_schema collation applicability view - #27472

Merged
mergify[bot] merged 18 commits into
matrixorigin:mainfrom
daviszhen:fix-issue-25103
Aug 24, 2026
Merged

fix: add information_schema collation applicability view#27472
mergify[bot] merged 18 commits into
matrixorigin:mainfrom
daviszhen:fix-issue-25103

Conversation

@daviszhen

@daviszhen daviszhen commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #25103

What this PR does / why we need it:

  • Add information_schema.COLLATION_CHARACTER_SET_APPLICABILITY as a view derived from information_schema.COLLATIONS.
  • Initialize the view for new tenants and create it for existing tenants through the v4.0.6 tenant upgrade path.
  • Add upgrade/unit coverage and a distributed regression for querying the object and its two MySQL-compatible columns.

The JDBC HAVING compatibility fix from PR #27244 is already present on current main; this PR addresses the remaining missing information-schema object from issue #25103.

Validation

  • timeout 900s .agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/util/sysview ./pkg/bootstrap/versions/v4_0_6 -count=1
  • git diff --check
  • Verified the view definition executes and exposes the expected two columns on a local MatrixOne service.

Fixes #25103

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 27a4db4. New tenants initialize the view, existing tenants receive a definition-checked/repaired v4.0.6 upgrade, and the view derives its two MySQL-compatible columns directly from INFORMATION_SCHEMA.COLLATIONS. No blocking issue found.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes on exact HEAD 27a4db4.

[P1 compatibility] The new object must contain the collation mapping; creating an empty view does not fix the ORM introspection path from #25103.

InformationSchemaCollationCharacterSetApplicabilityDDL selects from information_schema.COLLATIONS, but that object is an unpopulated physical table. The new BVT explicitly locks in COUNT(*) = 0. Meanwhile SHOW COLLATION exposes five supported collations from frontend.Collations.

Doctrine DBAL uses this object as data, not only as an existence probe. Its MySQL platform query does:

FROM information_schema.TABLES t
INNER JOIN information_schema.COLLATION_CHARACTER_SET_APPLICABILITY ccsa
  ON ccsa.COLLATION_NAME = t.TABLE_COLLATION

With this HEAD, the empty mapping removes every table from that introspection result. The original missing-object error therefore becomes an empty schema result.

Please populate or derive COLLATIONS/CCSA from one authoritative supported-collation list for both new and upgraded tenants, and add a regression that joins a known information_schema.TABLES row to CCSA and returns its CHARACTER_SET_NAME. At minimum every collation advertised by SHOW COLLATION and used by TABLES.TABLE_COLLATION must have a mapping row.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Addressed the latest P1 in 15632d18f1 and merged the current upstream/main (dda2b78d4f).

  • Added one canonical SupportedCollationDefinitions list. COLLATIONS data, COLLATION_CHARACTER_SET_APPLICABILITY, and SHOW COLLATION now use the same six executable identities, including the accepted utf8mb4_0900_ai_ci compatibility alias used by information_schema.TABLES.TABLE_COLLATION.
  • New tenants create COLLATIONS, populate the canonical rows, then create CCSA. The v4.0.6 tenant upgrade deletes/repopulates legacy rows before creating/repairing CCSA, with an exact-row-count/content check for idempotency.
  • Replaced the old empty-result BVT assertions with a populated mapping check and a real TABLES → CCSA join returning utf8mb4; updated SHOW COLLATION expectations.

Validation passed with CGO-enabled focused tests:
go test ./pkg/util/sysview ./pkg/frontend ./pkg/bootstrap/versions/v4_0_6 -count=1
plus git diff --check.

The new head is pushed and CI has been restarted. Please re-review 15632d18f1.

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head a98ea1ffae2d519c48c545771a665374f4965984. The original empty-CCSA blocker is fixed, but one blocking metadata-consistency issue remains; see the inline comment.

Validation: go list, go build, go vet, and the full tests for pkg/util/sysview, pkg/frontend, and pkg/bootstrap/versions/v4_0_6 passed. The focused tests also passed with -race -count=20. A temporary cross-surface invariant test reproduced the reported mismatch and was removed afterward.

Comment thread pkg/util/sysview/collation.go
@daviszhen

Copy link
Copy Markdown
Contributor Author

Addressed the remaining P1 metadata-consistency issue in commit 103487fa5db734284d8dd77abe6207dea3979bb8.

  • Added sysview.DefaultCollationForCharset, backed by the canonical SupportedCollationDefinitions.
  • Generated CHARACTER_SETS defaults from that canonical source and aligned SCHEMATA.DEFAULT_COLLATION_NAME, TABLES.TABLE_COLLATION, and VIEWS.COLLATION_CONNECTION.
  • Updated the v4.0.6 upgrade check so existing tenants are validated against the same defaults.
  • Added unit, upgrade, and BVT cross-surface regression coverage. utf8mb4_0900_ai_ci remains an advertised compatibility alias, while utf8mb4_general_ci is the canonical default represented by IS_DEFAULT='YES'.

Validation passed:
go test ./pkg/util/sysview ./pkg/bootstrap/versions/v4_0_6 ./pkg/frontend -count=1
git diff --check

Please re-review the new head.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep-reviewed exact head 103487f. The two prior blockers are closed: COLLATIONS/CCSA now materialize the canonical six-row mapping for both new and upgraded tenants, and CHARACTER_SETS plus SCHEMATA/TABLES/VIEWS derive the same executable per-charset defaults. The Doctrine-style TABLES-to-CCSA join and cross-surface default invariant are covered. Upgrade checks are idempotent and exact for COLLATIONS; no resource, wait, or unbounded-growth issue found. Local build, vet, full tests for pkg/util/sysview, pkg/frontend, and pkg/bootstrap/versions/v4_0_6, diff check, and current-main merge-tree all passed.

@aptend aptend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head a235a32be5819425dcadbed56de56b0753739d12 against the previously reviewed head a98ea1ffae2d519c48c545771a665374f4965984, including all review history/thread state, the incremental diff, and the complete current diff.

The prior cross-surface default-collation blocker is closed: one canonical definition now drives COLLATIONS, CHARACTER_SETS, SCHEMATA, TABLES, VIEWS, SHOW COLLATION, and the v4.0.6 same-version-offset tenant repair. The new CCSA view derives its mapping from the populated COLLATIONS table, and new-tenant ordering plus existing-tenant upgrade ordering are consistent. The exact utf8mb4_0900_ai_ci spelling is executable as the already-supported MySQL-8 compatibility alias, while the advertised PAD SPACE metadata matches MatrixOne's normalized general_ci semantics.

Verification passed: diff check; go list/build/vet for pkg/util/sysview, pkg/bootstrap/versions/v4_0_6, and pkg/frontend; full tests for those package trees; and focused race tests repeated 20 times. The two red Ubuntu jobs are unrelated failures in untouched packages (pkg/sql/plan self-FK routing and pkg/util/metric hardware detection). No blocking issue found.

@LeftHandCold LeftHandCold left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep-reviewed exact head 1708610e812ace21b08310c75ce043f46cbcf30e. The latest delta only adds the unknown-charset fallback assertion and does not change production behavior. The full closure remains consistent: one canonical collation definition drives COLLATIONS, CCSA, CHARACTER_SETS, SCHEMATA/TABLES/VIEWS, SHOW COLLATION, new-tenant bootstrap, and the v4.0.6 existing-tenant repair; upgrade ordering and exact-content checks remain idempotent. No correctness, compatibility, leak, hang, or unbounded-growth blocker found. Fresh CGo-controlled full tests passed for pkg/util/sysview, pkg/bootstrap/versions/v4_0_6, and pkg/frontend with -p=1; diff check and merge with current main also passed. Current red CI signatures are in untouched areas (pkg/sql/plan self-FK routing and TestHardwareCPU) and are unrelated to this PR. APPROVE.

@mergify

mergify Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-24 09:21 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-24 09:21 UTC · at 6118e2f93605d35554a0919db1d7a96646ed6083 · squash

This pull request spent 49 seconds in the queue, including 3 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

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

Labels

kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: information_schema gaps break schema-migration tooling

7 participants