Repository navigation
test: cover canonical collation admission and legacy SQL behavior - #29055
Conversation
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [x] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #28164 ## What this PR does / why we need it: PR1 is the foundation of the staged #28164 implementation. It adds the fixed Vitess v0.24.0 weight adapter and freezes the candidate V1 key payload for the supported text semantics, while preserving the existing tuple framing and legacy behavior. Changes: - pin Vitess v0.24.0 and its required module dependency closure; - provide general-ci, utf8mb4_bin, utf8mb4_0900_ai_ci and utf8mb4_0900_bin weight paths; - validate UTF-8, bounded output, malformed payloads, ownership and binary fast paths; - record the independent MySQL oracle, golden bytes and tuple evidence; - keep production admission disabled and make no SQL/index activation change in this PR. Dependency order: 1. This is the first implementation PR and is based on the #28164 design in #28842. 2. PR #29055 (`codex/28164-pr2-metadata-tuple`, `d21a9b5e94`) depends on this PR. 3. PR #29056 (`codex/28164-pr3-sql-semantics`, `0f06a4339e`) depends on PR1 and PR2. 4. PR #29057 (`codex/28164-pr4-index-readwrite`, `2de15a3e98`) depends on PR1–PR3. The branch was extracted from stack baseline `3a50d04378`. Before this update it was synchronized with the current GitHub target `main` at `780ef933f2` via a merge; the PR diff remains scoped to the foundation changes. Validation: - Independent PR1 `go list`, `go build`, `go vet` and package tests for `./pkg/common/collation` and `./pkg/container/types`: PASS. - MySQL 8.0.45 comparison and frozen-byte evidence: PASS for the codec scope. - Full SQL, index, persisted-filter, migration, mixed-version and production-activation validation: NOT_RUN. - BVT: N/A for this foundation layer because native semantics remain rejected by default and no production SQL path is admitted here. Consumer and integrated DML PRs must provide the runtime SQL evidence. QA required: yes. QA must validate the complete #28164 chain, including SQL semantics, DML/index behavior, persisted filtering, migration/recovery and compatibility gates. This PR alone is not production-ready; it is Ready for review while production activation remains disabled. Review and repair status (prior repairs are from the first-parent history; current update is exact head `013b9514ec57d7ed71054be8f46aa6e2d7c8d33b`): - Fixed the confirmed SCA blocker by replacing the four production `errors.New` sentinels in `pkg/common/collation/key.go` with repository `moerr` sentinels; `make err-check` passes. - Made the AWS SDK v2 dependency upgrade explicit and compatible: `NewAwsSDKv2` selects `RequestChecksumCalculationWhenRequired` and `ResponseChecksumValidationWhenRequired`, with a constructor regression test. - Fixed multi-object delete compatibility: when an endpoint rejects the new SDK checksum with `MissingContentMD5`, `InvalidDigest`, `BadDigest` or `InvalidRequest`, MatrixOne disables batch deletion and falls back to individual `DeleteObject` calls. The HTTP regression verifies the first batch rejection, all single deletes, and subsequent batch disablement. - Narrowed the fallback comment so it does not claim general batch atomicity. - Reclassified tuple/decoder and Packer results in the design evidence as historical integration evidence; PR2 must re-run them against its own source. Current source hashes include the AWS deletion path and tests; historical commands, hashes and raw logs are grouped separately. - Local validation: current collation package list/build/vet/tests, `make err-check`, focused fileservice tests including the checksum-rejection fallback, JSON validation and base-to-head diff check: PASS. Race/fuzz/benchmark reruns are explicitly marked NOT_RUN or BLOCKED_ENVIRONMENT. - Exact-head remote CI is re-running after this fix; full SQL/index, persisted filtering, migration, mixed-version and QA validation remain NOT_RUN for PR1. Current PR1 LIKE boundary (exact head `013b9514ec57d7ed71054be8f46aa6e2d7c8d33b`): - Removed the unvalidated `UCA0900AIMatch` export and its direct Vitess `Wildcard` call. No PR1 Go caller or matcher definition remains. - Weight generation, collation comparison adapters, V1 payload bytes and existing golden fixtures are unchanged. The evidence source hash for `pkg/common/collation/uca0900.go` is updated to this source. - LIKE is explicitly `NOT_RUN` in the evidence and belongs to PR3. PR3 must implement character-space `%`, `_` and escape semantics and add the MySQL oracle matrix; weight equality/order is not LIKE evidence. - A temporary fixed-Vitess probe observed `ss`/`ß` and reverse as true, and 31 repeated `%a` as true while 32/33 returned false. This is exploratory API-risk evidence only, not a PR1 or MySQL oracle PASS. - Post-update local validation: collation `go list`, `go build`, `go vet`, `go test -count=1`, `make err-check`, JSON/source-hash checks, helper-reference search and `git diff --check`: PASS. The PR is Ready for review. It remains a foundation PR and is not production-ready. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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. Approved by: @XuPeng-SH
## What type of PR is this? - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related issue: #28164 (C07 prerequisite; this PR does not claim to close the full native-Unicode unique-index feature). `#29486` is a closed duplicate/alias of the same compatibility investigation. ## What this PR does / why we need it: This change aligns the UNIQUE-index duplicate precheck with the physical key expression used by V1 index backfill: - keep the existing SQL byte-for-byte unchanged for legacy/non-physical-key cases; - group V1 composite and native-Unicode single/prefix keys by the exact physical key (`physical_serial` / `physical_collation_key`); - retain the original column expressions in the result so duplicate diagnostics remain readable; - preserve NULL filtering, including composite keys; - keep native-Unicode UNIQUE/PRIMARY admission fail-closed. This is a C07 prerequisite, not the complete DDL/DML/consumer rollout. The implementation is intentionally limited to the precheck boundary. V1 DDL publication, concurrent-writer fencing, rollback, indexed reads, and migration/rollout activation remain separate follow-up work. Existing broad draft work in #29055/#29056/#29057 is not duplicated here. Validation on the exact branch head: - `./.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/compile -run TestBuildCreateUniqueIndexDuplicateCheckSQL -count=1` - `./.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/compile -run 'Test(BuildCreateUniqueIndexDuplicateCheckSQL|GenInsertIndexTableSql|PrecheckAndInsertUniqueIndexTable|CreateIndexBackfillScopesPrePipelineLockToInsert)' -count=1` - `./.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/compile -count=1` - `make cgo` - `make build` - `git diff --check` An additional live SQL probe under `ONLY_FULL_GROUP_BY` returned one duplicate for single, composite, and prefix Unicode cases and confirmed NULL filtering. The probe used the existing local Docker MatrixOne listener; the package/build checks above were run against this branch. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Merge Queue Status
This pull request spent 1 hour 11 minutes 49 seconds in the queue, with no time running CI. ReasonThe merge conditions cannot be satisfied due to failing checks
HintYou may have to fix your CI before adding the pull request to the queue again. Waiting for any of
All conditions
Requeued — the merge queue status continues in this comment ↓. |
386ef54 to
be3bce0
Compare
Merge Queue Status
This pull request spent 29 minutes in the queue, with no time running CI. ReasonPull request #29055 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #28164 (partial regression coverage; do not close the issue).
What this PR does / why we need it:
Add regression coverage for the existing canonical collation admission policy and characterize the public legacy SQL behavior while native 0900 identities and physical key format 1 remain disabled. The complete diff is one Go test and one SQL/result pair; it changes no production implementation or persisted format.
The Go test preserves admitted legacy identities 0–3 at revision 0 and existing UCA400 identities 9/10 at revision 1 with format 0, and checks rejection of native 0900, invalid metadata and versioned physical formats. The BVT checks unsupported 0900-bin DDL, unchanged legacy comparison behavior, persisted column collation names, and failed-DDL/teardown outcomes. Expression COLLATE is currently discarded by the parser; the numeric, NULL and folded-expression cases characterize that inherited limitation and do not demonstrate native expression admission or full MySQL compatibility.
Validation:
8542e40ed0cfa000abd1f09dc6051bfb7c173868; comparison base:11914526ba0cd40d471299d8e5e2929909b9e09c.mo-cgo-test -p 1 -count=1 -timeout=20m -v, CGo and SIMD enabled: common/collation, container/types, pb/plan, sql/plan, sql/plan/function and sql/compile. The raw output includes the added test and 7,445 top-level passes, zero failures.test/distributed/cases/charset_collation/issue_28164_legacy_native_gate.sqlpassed normal comparison twice on the same ready instance, each with 16 successes and zero failures, ignored or abnormal cases. Both database teardown checks passed; the owned service/process group was absent afterward.2d97b7fa0ef4892152c950c326bd7675555a0a5f, SHA-25641c43eea4bd190838650d68fd74186c4e7b317f98ee9a8499c9812943a75a4ed. Only the two BVT files changed afterward, so production-source-equivalent binary and unchanged Go-test evidence were reused without relabeling the build revision.Dependency: #29054 merged at
22d43911d3f6c51872c1852340265a7d3f206925, which is an ancestor of this head. Later #29056/#29057 work must reconcile with the canonical owners; it is not needed to admit this test-only checkpoint for review. Current main5c959556431225711a33d1af5fe9a5b6d4060122was inspected for relevant owner changes. Its IndexSearchScan visitor and JSON EXPLAIN additions do not alter the direct admission policy or this case's SQL paths; local runtime evidence remains bound to the stated frozen source, not to current main.QA required: yes — the parent issue concerns user-visible compatibility and unique-key behavior, and full issue acceptance remains open. This PR's automated terminal covers legacy SQL results, metadata/rejection and fixture cleanup. Full COLLATE/ODKU semantics, native activation, key migration/recovery, mixed-version execution, full prepared-wire behavior, broader physical-key/hash/dedup and deployment QA are not established by this checkpoint. No new hot-path behavior is introduced, so this test-only change has no performance benchmark claim.
Ready for review means this bounded regression-coverage change is available for maintainer review. It does not signify merge approval, issue closure, native enablement or QA acceptance.
Latest-main synchronization (2026-10-14)
Rebased the regression-only change onto main
a53390c57de48ac280249ff0e88831e502e20fb0; published headbe3bce0bbb5ca4d5dd443ea63aadd7cbeeaa4442. Earlier feature commits had already been superseded by canonical main, so the second-parent-relative regression delta from the integration merge and its follow-up were preserved as a two-commit rebased chain rather than resurrecting those historical implementations. The final diff remains exactly the same three regression files, byte-for-byte identical to the previous head386ef54c07d0e32f0a69324018be185062ee9c45and previously validated8542e40ed0cfa000abd1f09dc6051bfb7c173868; no production or workflow changes were added to the PR. Patch-equivalence, relevant canonical-owner comparison, clean-state and whitespace checks passed. Main's new Iceberg module workflow is inherited by the branch.The runtime/CI results above remain bound to their stated historical revisions. No fresh local Go or SQL/BVT execution is claimed for the rebased head; current-head CI is pending. Mergify previously dequeued this PR after run 38517810418 was cancelled; CI Required reported the cancelled parent CI, not a diagnosed product-test failure. The cancellation cause remains unknown, and this synchronization does not claim to fix it. No manual rerun or queue action was taken. Ready state and the parent issue's remaining QA scope are unchanged.