Skip to content

[Design] Define collation-aware unique key identity (#28164) - #28423

Merged
XuPeng-SH merged 18 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28164-collation-key-design
Sep 9, 2026
Merged

XuPeng-SH merged 18 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28164-collation-key-design

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #28164

What this PR does / why we need it:

This is a design-only delivery for the string PK/UNIQUE identity bug.
It does not claim that the issue is fixed or close the issue. Revision 2 closes
the local design findings and is ready for maintainer review; production codec
and migration implementation remain a separate PR series.

Changes:

  • Separates SQL equality, unique-key identity, stored-value identity, and FULLTEXT maintenance identity.
  • Defines a shared, versioned, framed collation-key codec contract, exact normalization order, stable domain registry, type/payload framing, composite/NULL rules, and normative golden vectors.
  • Specifies relation-level metadata locations (api.SchemaExtra field 20 and plan.TableDef field 40), typed CN/TN capability and activation generations, explicit copy-boundary checks, and a persisted stop-write migration gate with transaction drain, collision abort, and atomic publication.
  • Selects a storage-owned encoded-key sidecar with source-row locators while keeping user PK/FK/FULLTEXT values unchanged; maps every writer, probe, lock, batch arbiter, persisted index, query optimization, rebuild, and recovery consumer.
  • Records the normalized utf8mb4_0900_ai_ci compatibility policy, rejected alternatives, review dispositions, and the implementation-series acceptance matrix.

Scope and non-goals:

  • No production Go code, SQL behavior, catalog/protobuf files, storage format, or canonical BVT expectations change in this PR.
  • The future implementation must preserve the current ODKU restriction on modifying PK/UNIQUE columns and must keep FULLTEXT posting identity separate from SQL collation equality.
  • Existing byte-oriented relations are not silently reinterpreted; migration is explicit and collision-safe.

Validation:

  • Unit/integration: make build PASS on exact baseline c51bb4ed868219af720cb5c019fb103bc1e7bcc7; binary SHA256 5df08fdacb616ce15d56194c803f043275f8f610f15d7347826fd346c22a83ec.
  • BVT: N/A — this PR changes documentation only and introduces no executable behavior; production behavior is not changed by a design document.
  • Equivalent regression evidence: the exact current-main MySQL probe in the ignored run artifacts executes the issue SQL through the production SQL entry point and records the three-row failure plus binary/NULL controls; the corrected run repeats the original sequence in three independent databases; Sections 9 and 10 define the executable BVT oracle for the implementation series.
  • Baseline behavior: FAIL / REPRODUCED — current main accepts Alpha, alpha, and Alpha as three unique rows after the issue ODKU sequence; the forced-index read agrees with the table scan. The same-batch ODKU and ordinary INSERT controls also accept case-equivalent values. VARBINARY and nullable-UNIQUE controls retain their expected independent/NULL behavior.
  • PR-head behavior: N/A — no production implementation is included.
  • Exact-content snapshot: head 53eff80bc9dce91cf0b037f68b5ae4e4f419672c, base/merge-base 9f87b6249889107c3c108c133a4c3c8f3bc273ee, diff hash e108b148087cf7cfa34da2e63eb086ce3d0dbd4b362f043e7eecbde28185b72b, git diff --check PASS. The branch is synchronized with the current main; the PR diff against its base contains only this design document.
  • Evidence: original current-main SQL output is retained in artifacts/issue-28164-design/20260908T102749Z/; the three-sample correction is in artifacts/issue-28164-design/20260909T000000Z/.

QA required: yes — the implementation series will change a user-visible SQL uniqueness terminal and persistent key identity across concurrent writes, index rebuild, restart, backup/restore, and rolling-version capability boundaries. QA must exercise the real INSERT/ODKU, INSERT/IGNORE, REPLACE, UPDATE, migration, and recovery paths on the supported deployment topology. QA acceptance is not run by this design PR.

Status: baseline_reproduction=PASS, design_completeness=PASS, design_review=READY_FOR_MAINTAINER_REVIEW, production_fix=NOT_IMPLEMENTED, qa_acceptance=NOT_RUN. #28164 remains open pending maintainer review and separately implemented/validated codec and migration work.

大雾重重 and others added 4 commits April 24, 2026 13:59
- Rename sample types to alloc_objects, alloc_space, inuse_objects, inuse_space; default inuse_space
- Set PeriodType, Period, TimeNanos, and Mapping.HasFunctions in Profiler.Write
- Add heap_profiler_pprof_test for profile.Parse round-trip
- Add [malloc] block to mo_checkin_regression_tke.yaml for tp/dn

Made-with: Cursor
@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

Addressed the current XuPeng-SH review findings in design revision 3 at commit fa8e7c4.

  • P1: Section 6 now names the terminal recovery owner, persisted claim-and-fence token, per-phase deadlines, pre-publication abort and cleanup, uncertain publication outcome resolution, and replay-target reconnect/retirement. Section 9 adds deterministic owner-loss, uncertain-commit, and missing-target acceptance cases.
  • P2: Sections 4.2-4.3 now make domain IDs normalization families and encode canonical validated per-part parameters in the envelope, so the family/parameter pair is the complete identity. Golden vectors include the parameter descriptors.

This PR remains design-only; no production implementation or QA acceptance is claimed. Exact-base snapshot, review-surface/obligation identity, and diff-check passed. Please re-review the updated design revision.

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

Design re-review of revision 3 at exact head fa8e7c48eb43f27421b01cc219add8b7457efe8d, against unchanged base/merge-base 9f87b6249889107c3c108c133a4c3c8f3bc273ee. APPROVE: both design blockers from my review of 53eff80bc9dce91cf0b037f68b5ae4e4f419672c are addressed.

  • P1 recovery/termination: the durable gate now identifies the owner incarnation and claim token, names HAKeeper's DDL recovery coordinator as terminal owner, and requires a current epoch/token for every EXCLUSIVE-side effect. CAS takeover and phase deadlines cover owner loss. Pre-publication abort separates reopening the old relation from idempotent invisible-temporary cleanup. Uncertain publication is resolved through the durable transaction/log barrier rather than guessed to be an abort. Post-commit recovery retains v2, while replay targets must acknowledge the generation or be explicitly fenced/retired. The three new barrier-driven acceptance cases exercise the previously missing terminal paths and stale-owner exclusion. Continued rejection while durable outcome/membership authority is unavailable is an explicit safety choice, not an unconditional availability promise.
  • P2 domain identity: IDs now identify immutable normalization families; canonical length-delimited per-part parameters carry prefix/unit and numeric width/scale. Consequently the complete identity is (family ID, canonical parameters), and different supported parameters no longer require locally inventing registry entries or changing the cluster manifest digest. Type/family/parameter validation and hashing cover that descriptor, including NULL parts. Independently parsed all eight explicit revised hex envelopes: part counts, descriptor lengths, payload lengths and complete consumption agree with the layout.

Read the full incremental document change and reused the unchanged baseline/source closures from the prior complete review. Rechecked the new decisions against sidecar publication, snapshot/locator ownership, all-writer/TN fencing, FK and FULLTEXT original-value preservation, normalized collation/PAD policy, typed metadata propagation, mixed-version readers, backup/restore, conservative pruning and the codec/input-row performance model. No new confirmed design blocker remains. The implementation still must exercise multiple widths/prefixes/scales and malformed parameter descriptors, prove actual cross-service fencing/cleanup with the named deterministic cases, and satisfy the existing public SQL/prepared/concurrency/persistence/performance acceptance matrix. This approval is for the design, not production implementation or QA acceptance.

Exact-head CI run 34283368197 completed successfully; no new executable behavior is introduced by this documentation-only PR. The PR body's older content snapshot was not reused as exact-head validation. No native implementation tests, new SQL reproduction or benchmarks were run, and no repository code was changed. The self-review design gate and unhappy-path ownership/termination checks guided this re-review.

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

mergify Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-09 00:43 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-09 00:45 UTC · at e8f12ff3a5658005e73a8e60c13f1c5e96ac1017

This pull request spent 1 minute 43 seconds in the queue, with no time running CI.

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

Reason

Pull request #28423 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You 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.
If you do update this pull request, 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.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
ci — e8f12ff3 Deployed Sep 9, 2026 by mergify[bot] via Matrixone Utils CI / Coverage #51855
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 size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants