Skip to content

feat(collation): add isolated MySQL UCA400 key backend - #29478

Merged
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
daviszhen:codex/issue-29206-uca400-backend
Sep 29, 2026
Merged

mergify[bot] merged 4 commits into
matrixorigin:mainfrom
daviszhen:codex/issue-29206-uca400-backend

Conversation

@daviszhen

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:

Related to #29206. This is a standalone backend prerequisite, not a change that closes the issue or enables either SQL collation name.

What this PR does / why we need it:

Add isolated MySQL-compatible UCA 4.0.0 comparison-key domains for future utf8mb4_unicode_ci and utf8_unicode_ci support. These collations cannot safely be aliased to general-ci or UCA 9.0: their equivalence and padding contracts differ.

  • Reuse the already pinned Vitess v0.24.0 UCA400 backend and introduce U4P1 byte framing for PAD SPACE ordering, including control characters and interior/trailing space runs.
  • Preserve all existing domain values and frozen keys. The new mb3 domain rejects supplementary characters; both new domains reject malformed UTF-8 and check size overflow before modifying caller scratch.
  • Correct the independently observed U+FFFF discrepancy locally: MySQL 8.4.11 emits FBC1 FFFF, while the pinned Vitess table emits no weights. Existing backends and the dependency remain unchanged.
  • Commit the independent MySQL oracle, read-only regeneration script, frozen sample-key digest, error/reuse tests, scalar-bound checks and design document.

Scope and follow-up

No SQL admission, persisted schema IDs, catalog, planner or index paths change. Both SQL collation names remain unsupported. Follow-up integration must reconcile metadata/tuple, SQL consumers and index maintenance with #29055–#29057, plus persisted filtering, recovery and mixed-version admission. Database default inheritance must also coordinate with #29374. This backend can be reviewed independently of those drafts.

Validation

Validated commit: 8769a01e26eaf97e094460d164ef3091dd3065da, based on main d8152cb08d7e73316034c33aaf0e7bc01c176f91.

Local macOS arm64, using existing native CGo libraries:

  • go test ./pkg/common/collation -count=1: PASS, including unchanged existing key-freeze tests.
  • go test ./pkg/common/collation -race -count=1 -cover: PASS; package statement coverage 94.8% (not PR changed-line coverage).
  • go vet ./pkg/common/collation and git diff --check: PASS.
  • Independent MySQL Community Server 8.4.11 arm64, isolated Unix socket with networking disabled: 98 samples, 9,604 ordered-pair comparisons, and 65,536 scalar weight answers (all valid BMP scalars plus 2,048 supplementary samples). MySQL mb3 weights/order independently checked for the BMP sample subset.
  • Exhaustive Unicode-scalar tests verify the pinned backend's size bound and mb3 repertoire handling.
  • Apple M5 non-race microbenchmarks: ASCII 204 ns/op, expansion 157 ns/op, spaces 113 ns/op; 2 allocations/op. These are library measurements, not an SQL workload performance claim.

Full SQL/application/distributed BVT is not claimed: this PR deliberately leaves SQL activation closed. GitHub CI is pending and separate from local validation.

GPT-6 Sol medium design and final overall review completed with no remaining material blocker. The review covered framing, bounded resources, oracle independence, compatibility and the disabled admission boundary.

@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 →

@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 review of exact commit 8769a01 against d8152cb.

Design: the bounded library-only increment is coherent. Existing Domain values/key bytes are unchanged; the two domains reuse the pinned Vitess table, with the independently observed U+FFFF correction localized to the adapter. No SQL/catalog/index activation is implied. U4P1 preserves PAD SPACE ordering (including lower-than-SPACE weights), and its validator enforces canonical framing. Repertoire/UTF-8/overflow rejection occurs before scratch mutation; buffers have linear checked size bounds and no cross-call ownership.

Read all source/test/documentation changes and the independent oracle generator/fixture contract. I independently ran the whole collation package at this commit, including a private 100,000-pair deterministic sequence challenge: concatenate committed MySQL sample inputs and raw oracle weights, compare the latter with a separate implicit-SPACE comparator, then compare public Key outputs and ValidateKey. PASS; package 2.805s. Existing frozen domains, all BMP plus sampled supplementary oracle mappings, full scalar allocation bounds, malformed input, scratch reuse and framing tests also passed. The private QA test was kept outside the submitted change.

No blocking design, correctness, unhappy-path, performance or test-quality finding in this isolated foundation. There were no prior substantive review comments to close. Approval does not claim native SQL collation support or close the explicitly deferred integration/rollout gates of #29206.

@mergify mergify Bot added the queued label Sep 29, 2026
@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-29 08:50 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in-place
  • 🚫 Left the queue — 2026-09-29 10:00 UTC · at 0236e6806464a047675691b230e183ed818c2def

This pull request spent 1 hour 10 minutes 50 seconds in the queue, with no time running CI.

Reason

The merge conditions cannot be satisfied due to failing checks

  • Mergify Merge Protections
  • CI Required

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added dequeued and removed queued labels Sep 29, 2026
@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-29 11:36 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-09-29 12:46 UTC · at bd62a7166c84bfce141eb6e9ae88f775c1f470b7 · squash

This pull request spent 1 hour 10 minutes 12 seconds in the queue, including 1 hour 9 minutes 53 seconds running CI.

Required conditions to merge

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

kind/documentation Improvements or additions to documentation kind/enhancement kind/feature kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants