Skip to content

fix: implement MySQL MEDIUMINT semantics - #29818

Merged
XuPeng-SH merged 10 commits into
matrixorigin:mainfrom
Lundomn:codex/issue-29723-mediumint
Oct 12, 2026
Merged

XuPeng-SH merged 10 commits into
matrixorigin:mainfrom
Lundomn:codex/issue-29723-mediumint

Conversation

@Lundomn

@Lundomn Lundomn commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes

Fixes #29723

What this PR does / why we need it:

Implements MySQL MEDIUMINT and INT3 as signed or unsigned 24-bit types while retaining MatrixOne's existing 32-bit physical storage. Writes enforce the correct range, INT(24) remains an ordinary 32-bit INT, and SHOW CREATE TABLE, information_schema, and MySQL result metadata preserve MEDIUMINT identity. Mixed-version gates prevent older CNs from executing new MEDIUMINT assignment checks.

The follow-up also addresses the four reproduced review findings:

The protocol analyzer recognizes assignment cast IDs 541/554/555 and checks the cast target argument, so widened outer result metadata cannot hide a MEDIUMINT write requirement. Generic CAST ID 21 remains ungated. The MEDIUMINT feature floor is v110; main uses v109 for Unicode collation metadata.

Coverage includes signed/unsigned boundaries, defaults, generated values, regular and prepared INSERT, INSERT SELECT, UPDATE, LOAD DATA, narrowing ALTER, auto-increment, persisted catalog/restart, typed-array assignment, comparison casts, UNION/CASE widening, invalid defaults in both SQL modes, and Arrow dictionary NULL handling.

This branch is rebased on current main at 7af631bdf79e7beb4bb3588e2bfd03ba4852b6cc. That main commit corrects the pre-existing Top-N test mismatch tracked in #29968: tuple/interval remain unsupported order keys, while T_any is accepted for domainless NULL ordering. The fix is a test-contract correction; it changes no comparator behavior and adds no partition code to this PR.

Design: MEDIUMINT review corrections records the type identity, existing responsibility owners, the four review dispositions, protocol compatibility, validation evidence, and remaining limits.

Validation

  • Post-rebase focused and full CGo tests for ./pkg/sql/colexec/partition and ./pkg/compare pass, including the corrected Top-N test and domainless NULL comparison.
  • Post-rebase MEDIUMINT SQL regressions pass: TestIssue29723MediumIntSemantics, TestIssue25103InformationSchemaMetadata, and TestIssue29723MediumIntAdjacentContracts.
  • Post-rebase protocol-fence tests pass in ./pkg/pb/plan, ./pkg/sql/plan, and ./pkg/sql/compile (remote/persisted feature detection, authoring gate, placement and send).
  • Pinned golangci-lint v2.14.0 reports 0 issues for ./pkg/sql/colexec/partition; gofmt and git diff --check are clean.
  • The full pkg/sql/compile suite has a verified clean-base failure in TestTruncateLifecycleRCWaitPolicy, tracked separately in #29971. This PR does not change that test or lifecycle behavior; focused MEDIUMINT remote-placement tests pass.

CAST(... AS MEDIUMINT) remains unsupported because MySQL does not accept MEDIUMINT as a CAST target. This change enforces strict out-of-range writes; full MySQL non-strict/IGNORE clipping and warning parity is not included. The Kafka/Flink CDC pipeline and full mo-tester DATALINK suite were not run.

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

@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Oct 10, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Oct 10, 2026
@Lundomn
Lundomn force-pushed the codex/issue-29723-mediumint branch from 323283b to 669ecb6 Compare October 10, 2026 07:25

@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 at head 669ecb6 (base and merge-base e5dd472).

[P1] Complete the mandatory design review for the new MEDIUMINT capability before implementation approval.

This is more than the original silent-widening bug fix: #29758 already made unsupported MEDIUMINT/INT3 fail explicitly. This PR now introduces their supported SQL domain, persists a new interpretation of INT32/UINT32 Width=24, exposes MYSQL_TYPE_INT24, changes assignment/import/auto-increment consumers, and raises the MORPC compatibility contract to v109. The issue's follow-up explicitly requests this new capability. Reusing 32-bit physical storage is a plausible direction, but it does not make the catalog and compatibility decisions mechanical.

The design-first gate applies on both scope and complexity: production changes are +556/-43 across 33 files in 11 packages (tests/results separately +1037/-53 in 21 files; docs 0), and the feature changes public type metadata, persisted semantics, distributed execution compatibility, and upgrade/restart behavior. I checked the PR body, all available issue/review comments, docs/design and docs/rfcs at this head, and repository PR/design searches. There is no linked exact revision of an independently approved design for this feature. The requirements in #29723 and the implementation/green tests do not replace that artifact.

Please link a stable versioned design and obtain a distinct design approval before the full implementation review. RFC format is optional. The design should close:

  • The authoritative logical-type identity and bounds, why Width=24 is unambiguous relative to INT(24)/existing persisted columns, and which existing owners are reused instead of creating parallel validation paths.
  • All assignment/metadata consumers (ordinary and prepared DML, defaults/generated expressions, ALTER, auto-increment, Arrow/Parquet/LOAD, typed arrays, MySQL metadata/dump/clone), with explicit strict/non-strict/IGNORE scope and failure behavior.
  • What v109 gates on authoring, remote execution, and persisted reads; old-CN admission, upgrade/restart/downgrade/rollback safety; and how old INT schemas are treated.
  • Credible representation alternatives and the cost/benefit of the selected one, plus acceptance evidence for boundaries, adjacent ordinary-INT controls, failure/reuse, compatibility, and TP/import overhead.

Policy used: .agents/skills/mo-self-review/SKILL.md, "Missing/unapproved or failed design makes the decision REQUEST_CHANGES and short-circuits full implementation polishing", together with .agents/skills/mo-dev/references/feature-design-review.md sections 1–2. I inspected implementation only far enough to establish these concrete design obligations. This is an artifact/decision blocker, not a claim that a runtime bug has already been demonstrated. Full implementation/test-quality/performance closure is deliberately pending design approval; no local runtime test results are claimed for this PR. There were no pre-existing substantive PR review threads to close.

@XuPeng-SH

XuPeng-SH commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 9b6aa3add9ef9565d5880d2bf2d280700c2e050b

Assessment: approve

Reviewed the complete 62-file delta and surrounding owners/callers. The four prior findings are addressed with targeted regressions. The implementation follows the accepted design, and no actionable unresolved defect remains.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Verified the frozen HEAD, unchanged source checkout, and successful git diff --check. Reviewed production, test/result, and documentation changes separately.

  • Confirmed comparison casts bypass assignment bounds; common MEDIUMINT/INT results widen independently of branch order; constant defaults receive strict validation regardless of sql_mode; Arrow dictionary NULL validity precedes payload inspection.

  • Traced ordinary/prepared assignments, generated values, typed arrays, CSV/Parquet/Arrow imports, auto-increment, metadata, schema-copy consumers, and restart behavior.

  • Verified v110 authoring, placement, destination, receive, and persisted-expression gates, including actual assignment function IDs and target-argument detection after UNION metadata widening.

  • Reused frozen-head successful build, Ubuntu UT, Linux SCA, coverage, and selected multi-CN BVT checks, plus author-reported post-rebase MEDIUMINT SQL and protocol regressions. No local runtime tests were repeated.

  • Recorded scope, comment closure, evidence, and accepted limitations in attempt-3/review-audit.json and static-audit.json.

Limitations:

  • The evidence bundle contains CI conclusions and author validation reports, not current raw test logs; no independent local runtime or MySQL comparison was performed.

  • Historical width-24 values are not migrated. Downgrade below v110 after feature use requires explicit conversion or retaining compatible executors.

  • Full non-strict/IGNORE warning parity, live mixed-binary upgrade/downgrade, complete CDC, and dedicated dump/clone/Arrow SQL end-to-end validation remain outside the accepted evidence scope.

  • No new throughput measurement was available. MEDIUMINT assignment adds a linear bounds pass; no broad performance-regression claim is made.

@Lundomn
Lundomn requested a review from XuPeng-SH October 12, 2026 09:31

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

mo-bot review · mo-bot-local · review

Commit: 9b6aa3add9ef9565d5880d2bf2d280700c2e050b

Assessment: approve

Reviewed the complete 62-file delta and surrounding owners/callers. The four prior findings are addressed with targeted regressions. The implementation follows the accepted design, and no actionable unresolved defect remains.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Verified the frozen HEAD, unchanged source checkout, and successful git diff --check. Reviewed production, test/result, and documentation changes separately.

  • Confirmed comparison casts bypass assignment bounds; common MEDIUMINT/INT results widen independently of branch order; constant defaults receive strict validation regardless of sql_mode; Arrow dictionary NULL validity precedes payload inspection.

  • Traced ordinary/prepared assignments, generated values, typed arrays, CSV/Parquet/Arrow imports, auto-increment, metadata, schema-copy consumers, and restart behavior.

  • Verified v110 authoring, placement, destination, receive, and persisted-expression gates, including actual assignment function IDs and target-argument detection after UNION metadata widening.

  • Reused frozen-head successful build, Ubuntu UT, Linux SCA, coverage, and selected multi-CN BVT checks, plus author-reported post-rebase MEDIUMINT SQL and protocol regressions. No local runtime tests were repeated.

  • Recorded scope, comment closure, evidence, and accepted limitations in attempt-3/review-audit.json and static-audit.json.

Limitations:

  • The evidence bundle contains CI conclusions and author validation reports, not current raw test logs; no independent local runtime or MySQL comparison was performed.

  • Historical width-24 values are not migrated. Downgrade below v110 after feature use requires explicit conversion or retaining compatible executors.

  • Full non-strict/IGNORE warning parity, live mixed-binary upgrade/downgrade, complete CDC, and dedicated dump/clone/Arrow SQL end-to-end validation remain outside the accepted evidence scope.

  • No new throughput measurement was available. MEDIUMINT assignment adds a linear bounds pass; no broad performance-regression claim is made.

@mergify

mergify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

@mergify

mergify Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

queue

⚠️ Invalid commit message

Details

section not found

@mergify mergify Bot added the queued label Oct 12, 2026
@mergify

mergify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-12 10:17 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-12 10:24 UTC · at 963776a84e8c2d41dedbc69ecedd94367ed4c96f

This pull request spent 7 minutes 24 seconds in the queue, with no time running CI.

Reason

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

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

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 — 963776a8 Deployed Oct 12, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MEDIUMINT is silently created as INT and accepts out-of-range values

4 participants