Skip to content

fix(sql): isolate binary capacity and assignment semantics - #29057

Merged
XuPeng-SH merged 17 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/28164-pr4-index-readwrite
Nov 11, 2026
Merged

XuPeng-SH merged 17 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/28164-pr4-index-readwrite

Conversation

@VioletQwQ-0

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

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Related to #28164 — isolated binary byte-capacity, assignment and COPY/replay stage only; not the complete ODKU/collation issue and not a closing reference. Native0900 remains disabled.

What this PR does / why we need it:

Current scope and predecessor-data observations (2026-11-09)

Current head: d6400a6ed84e9312847f80f2e6d5708241405b86. The dated descriptions and binary-133 statements below refer to superseded PR heads. Against merge base 52cbba793b9a36b9d5d442bbded32d88f296e761, this head does not change pkg/defines, proto/plan.proto, proto/pipeline.proto, or generated protobuf files; see the current-scope review reply.

An isolated predecessor-data comparison ran the official v4.2.6 binary and a candidate built from snapshot 777a203f1434921da55e31ca871d556a32d547d5 (the same source tree as the current head) against the same stopped old store. All 24 compared SQL outcomes, rows, and warnings matched: 15 statements succeeded and nine produced matching errors. This is a compatibility observation, not a claim that all cases passed or that mixed-version deployment or QA is certified.

One legacy limitation needs an explicit compatibility decision: an existing BINARY(4) generated column created from src accepted and stored a six-byte UTF-8 value without a warning in strict mode on both binaries; an existing VARBINARY(8) generated column similarly stored nine bytes. A newly created corresponding column rejects overflow in strict mode and truncates with warnings in non-strict/IGNORE modes. The old behavior is not a new regression attributed to this PR, but preserving it versus applying new assignment rules to old generated columns changes existing write semantics and remains an owner/reviewer decision. Existing review and QA gates remain open.

The pinned selected version-pair evidence includes the original per-scenario results and fixture runner, with an executable checksum/observation verifier. It is selected evidence rather than the full archive or a turnkey environment; the same-tree snapshot identity and nine matching errors remain as described above. The owner decision and reviewer/QA gates remain open.

Current conditional-expression repair — 2026-10-26

Published head 166d606a71b8d989b26aa1c26da0c0a8ef32740c, validated tree b15de7be693c112c37ab6f2053d03d49511e9cf7, validation base 861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f. This is a five-file incremental fix on source 127f7374930680add809a06775e32ec29746ecb8; no base synchronization or history rewrite was needed.

IF/CASE common-type inference must not silently narrow a selected expression to VARBINARY(65535) merely because another branch is BINARY. Character widths are converted to a lossless byte bound; large or unknown bounds use the existing BLOB type. Identical fixed-BINARY/NULL and finite small binary results keep their established types. The evaluator and generic CAST fallback are unchanged. The actual destination assignment still owns strict rejection, non-strict/IGNORE truncation and warnings, fixed-width padding and physical replay. The earlier typed DECIMAL computation repair remains intact when a changed-session charset conversion retargets its binary destination.

Current-content local validation: Go1.27.1, Darwin/arm64 CGo CPU, actual official local make-cgo generation (192inputs/47artifacts independently matched):

  • Unfixed operatorSet control with the identical new production-binder/executor regression fails for the intended80000→65535-byte truncation. Fixed IF/CASE, reversed branch, NULL and actual assignment controls pass in strict/non-strict modes. This is a controlled single-file unfixed comparison, not a full-base deployment.
  • 30required positive named test roots pass, including capacity/opaque/assignment/replay and composed main132/binary133 placement/destination/actual-stream/receiver controls. Both changed owning packages ran normal mode without -short, -count=1: function13071PASS events; plan20173PASS events and2existingSKIP. These are test/subtest events, not unique tests or accumulated focused totals. Scoped vet, molint and configured incremental lint pass.
  • Normal canonical comparison on one SQL+ISCP-ready owned instance: test/distributed/cases/charset_collation/issue_28164_convert_binary_capacity.sql118/118 and test/distributed/cases/dtype/binary.test589/589, each twice (1414comparisons;0failed/ignored/abnormal). Capacity extends the existing99commands with19public IF/CASE/assignment commands and retains changed-session COPY, future INSERT/UPDATE and explicit MODIFY controls. Original teardown-before-fallback and final catalog/listener/process/staging/TMP closure verified. Canonical runner metadata comparison is disabled; no metadata or deployed QA pass is claimed.
  • Current-base stored-opaque projection/GROUP_CONCAT/limit behavior reconciled in two19-command same-instance rounds with an independent99-byte visible-text oracle. Earlier compact82-byte main125 results are historical, not the current oracle. Renderer, consumer, MIN/MAX, ODKU, proto and parser scope removals are confirmed by actual current-base source comparisons, not only PR-body claims.

Main1–132 remains authoritative and unchanged. The existing branch-local binary-assignment/replay133 guards persisted/local/cached plans, placement, destination, serialized stream and receiver. Float-only132 remains132; composed binary plans require133. This is not a cross-PR reservation; final authoritative allocation must be checked at landing. Offline stop-all-old-nodes upgrade is the intended contract; actual predecessor-binary migration/data acceptance remains uncertified. Component version controls are not genuine mixed-binary deployment proof.

Only this scoped repair is published. Reviewer decisions, responsible scope/authorship questions, predecessor cutover/data acceptance, deployed QA and the remainder of issue28164 stay independent. Historical request_changes is not cleared by pushing or requesting re-review. New CI belongs to this published head and is not inherited from source127.

QA Decision

  • required: yes
  • reason: user-visible expression/assignment and persisted COPY semantics need separate deployed data/cutover acceptance.
  • production_entrypoint: public SELECT IF/CASE, INSERT/IGNORE/strict assignments and charset-conversion COPY/future DML.
  • automated_terminal_coverage: current local normal owning packages, focused controls and canonical118+589twice with verified cleanup.
  • remaining_validation: exact new-head CI, per-reviewer decisions, supported predecessor offline-cutover/data evidence and deployed QA; full ODKU/collation/native0900 outside this bounded stage.
Historical evidence — original SHAs, modes and limitations retained

Preserve declared BINARY/VARBINARY byte capacity during charset conversion and enforce assignment width through the existing planner/CAST owners. Strict assignments reject overflow; non-strict and IGNORE assignments truncate with warnings. Preserve explicit BINARY casts, fixed-width padding, unchanged physical BINARY replay, and the zero-width opaque VARBINARY contract.

COPY validates source collation and retained default capacity. Charset conversion retargets the binary assignment without rebinding unchanged persisted DECIMAL computation under the current session; explicitly authored MODIFY retains current-session binding. The changed-session regression covers scale12 computation created with div_precision_increment=10, conversion under increment0, original COPY results, subsequent INSERT and UPDATE. Remove the unreachable binary-literal width branch and unused local helper argument.

Current maintenance head: 127f7374930680add809a06775e32ec29746ecb8, normal merge of source 595273e1dce9194a9938ef0c46a02b8e730f3b3a and validated main 861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f; reviewed/tested tree 70141121ea5e7abede9fa7380c9c3d22b97c3a0f.

Main's cumulative capabilities129–132 are unchanged: selected JSON ELT/opaque text129, incomplete temporal130, weighted percentile131, decimal/float conversion132. This isolated branch uses provisional binary-assignment/replay133 across persisted/cached/local plans, placement, destination, actual stream and receiver admission. Legitimate float-only132 remains132; binary and mixed float/binary plans require133. Main132 is not binary-capable merely because another feature uses that number. A final landing must recheck the authoritative allocation;133 is not a reservation or a cross-branch interoperability claim. Version changes describe new execution/persisted-expression semantics, not a per-PR counter. Existing capability owners are reused; no new compatibility state machine or retry is introduced.

Upgrade contract: stop all old nodes before starting the new version. Rolling old/new execution and downgrade are not supported acceptance scenarios. Admission rejection is a safety boundary, not a rolling-upgrade guarantee. Genuine predecessor-binary migration remains uncertified; current-code RPC version controls are component evidence only.

Current-content local validation on Go1.27.1, macOS arm64, official native build and repository CGo wrapper:

  • 19 serial phases passed, including45 required named roots, focused and owning -short -count=1 suites for defines, plan protobuf, compile, SQL planner, function and SQL util. Two existing owning-plan skipped subcases remain disclosed and are not passes. This is not full CI or a fresh race-suite claim.
  • Incremental formatting, vet, pinned molint and configured golangci-lint passed for the selected closure.
  • Canonical normal-comparison BVT on one owned ready instance: test/distributed/cases/charset_collation/issue_28164_convert_binary_capacity.sql99/99 twice and test/distributed/cases/dtype/binary.test589/589 twice. Zero failed/ignored/abnormal; original inputs/oracles preserved. Original teardown, catalog absence, listener shutdown and exact runtime cleanup verified.
  • Retained typed DECIMAL computation and current-session MODIFY controls passed through TestBinaryConversionRetainsSessionBoundComputation and TestCharsetConversionRetainsTypedComputation; the canonical capacity BVT exercises actual COPY, future INSERT and UPDATE after the session change.
  • The first main132/binary133 candidate failed a new placement fixture because its worker ID did not match the existing mock registration. The six-line test-only correction aligns that identity and requires an actual probe-counter increment. Failed-parent evidence remains retained; no product assertion, timeout or gate was weakened.

These receipts bind the published tree above. Earlier normal/race, retained-storage restart and latest-build two-CN evidence on source595273e1 is historical, not substituted for current-base runtime, race, upgrade or performance validation. New-head required CI is pending and must be checked independently.

No authored vector/batch, protobuf schema/generated-binding, parser grammar, JSON rendering, MIN/MAX, ODKU result-tracking or functional-index feature is introduced by this isolated binary stage. Incoming main changes are preserved. No workload-scale performance result or serving-model identity is claimed by this maintenance update.

QA required: yes — user-visible assignment/COPY and persisted generated-expression behavior require deployed acceptance. Local terminal coverage includes byte-capacity rejection/truncation, physical replay and changed-session DECIMAL COPY/future writes. Remaining gates include deployed QA, genuine predecessor-data shutdown-upgrade acceptance where required, final capability allocation and formal reviewer/design/scope decisions. No automatic thread resolution, whole-issue closure or merge is implied.

@matrix-meow matrix-meow added the size/XXL Denotes a PR that changes 2000+ lines label Sep 17, 2026
XuPeng-SH pushed a commit that referenced this pull request Sep 20, 2026
## 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>
mergify Bot pushed a commit that referenced this pull request Sep 29, 2026
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
@mergify mergify Bot added the kind/bug Something isn't working label Oct 9, 2026
XuPeng-SH pushed a commit that referenced this pull request Oct 11, 2026
## 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>
@XuPeng-SH

XuPeng-SH commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: c715ba1df1a19ec4a26362bdffd8252598b7574e

Review completed. Read the assessment.

@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: c715ba1df1a19ec4a26362bdffd8252598b7574e

Assessment: approve

Reviewed all 39 changed files and reconciled all 61 discussion entries. The prior DECIMAL replay, IF/CASE truncation, scope and binary protocol-gate concerns are resolved. No actionable unresolved findings remain in the bounded binary-capacity change.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Traced assignment consumers, conditional coercion, persisted-expression replay, COPY failure ownership, HEX metadata and allocator restart behavior.

  • Static audit passed: frozen source integrity, patch comparison, git diff --check, gofmt on 25 Go files, scope controls and discussion coverage. Receipt: checks/1793194083180541684-4.json; retained evidence: static-audit.log and static-audit.json.

  • The initial audit failed solely because the supplied patch omitted its terminal newline; its script, log and receipt are retained and reconciled in validation-reconciliation.json.

  • Frozen CI reports successful Ubuntu unit tests, static analysis, compose/proxy BVT and multi-CN pessimistic BVT for this head.

  • Saved review-plan.md, review-notes.md and discussion-assessment.json.

Limitations:

  • No local Go or SQL tests were run. Raw per-test CI logs were unavailable; historical execution reports are not claimed as fresh runs.

  • Predecessor-data upgrade and deployed QA were not validated. The broader collation/ODKU issue #28164 remains outside this PR's bounded scope.

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

Request changes on the remaining old-peer compatibility path. I reviewed the binary assignment, conditional-width and replay changes and reused passing CI; I did not run an additional local server test.

Comment thread pkg/sql/plan/build_constraint_util.go Resolved
@XuPeng-SH

XuPeng-SH commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: c715ba1df1a19ec4a26362bdffd8252598b7574e

Review completed. Read the assessment.

@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: c715ba1df1a19ec4a26362bdffd8252598b7574e

Assessment: request_changes

The latest gate-extension concern remains valid despite the earlier approval. Prior scope, DECIMAL replay, conditional truncation and dedicated binary-version findings are resolved.

Model: gpt-6-astra / xhigh

Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2

  • P2 pkg/sql/plan/build_constraint_util.go:1296: Adding binary/varbinary here routes newly authored binary DML through assignmentCastFunctionName's MORPCVersion5 gate, selecting legacy cast/cast_strict below that version.
    Impact: This violates the unchanged shutdown-upgrade policy prohibiting extensions of existing feature gates. It retains duplicate assignment paths and legacy-specific behavior in generic casts. Author binary DML directly with cast_assign/cast_ignore, remove binary-only old-peer fallback obligations, and preserve COPY/DDL semantics, actual persisted-expression compatibility and unrelated existing gates.
    Evidence: upgrade-compatibility.md:26 explicitly prohibits extending existing gates. build_constraint_util.go:1332 and :1456 implement the version-dependent selection; build_util_test.go:1468 adds binary tests requiring it. function/func_cast.go:10154 explicitly adds legacy IGNORE fallback behavior. This confirms review_comments:4414292821 as a policy/design defect, not an observed production failure.

Validation:

  • Reviewed the complete 39-file delta and reconciled all 65 discussion entries; saved review-plan.md, source-assessment.md and discussion-assessment.json.

  • Static audit passed: source identity, patch comparison, whitespace, gofmt on 25 Go files, unchanged policy and discussion coverage. Receipt: checks/1793289958852032051-2.json; logs/report: static-audit.log and static-audit.json.

  • Frozen CI metadata reports 13 successful, 14 skipped and 2 neutral checks; reconciliation retained in validation-reconciliation.json.

Limitations:

  • No fresh Go, SQL or upgrade execution; dependent implementation validation stopped at the confirmed design blocker.

  • Raw per-test CI logs and the previous review's local artifacts were unavailable. Broader collation/ODKU issue #28164 remains outside this bounded change.

…29057-current-main-20261026

# Conflicts:
#	pkg/sql/util/eval_expr_util.go
#	test/distributed/cases/dtype/binary.result
@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 7f381b49a7c8e40c8df8ab14a74b9e33f03bb5c0

Review completed. Read the assessment.

@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: 7f381b49a7c8e40c8df8ab14a74b9e33f03bb5c0

Assessment: approve

Reviewed all 39 changed files and reconciled all 67 discussion entries. The prior protocol-gate, decimal replay and conditional truncation concerns are resolved. No actionable unresolved findings remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • Traced assignment, COPY failure handling, persisted-expression replay, conditional coercion, HEX metadata and allocator restart consumers.

  • Static audit passed: source identity, patch consistency, whitespace, formatting of 25 Go files and discussion coverage. Receipt: checks/1793628491755325270-4.json; retained log: static-audit.log.

  • Frozen CI matches the assessed head and reports successful unit, static-analysis, proxy BVT and multi-CN pessimistic BVT checks. Skipped and neutral checks were not counted as passes.

  • Saved review-plan.md, review-notes.md, discussion-assessment.json and validation-reconciliation.json.

Limitations:

  • No fresh local Go or SQL execution; raw per-test CI logs and author-local receipts were unavailable.

  • Predecessor-data upgrade and deployed QA were not independently validated.

  • Broader collation and ODKU behavior in issue #28164 remains outside this isolated change.

@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 the complete current diff, including the binary result fixture as text and the surrounding assignment, common-type and persisted-DDL replay paths. Binary column capacity is enforced in bytes at the assignment owner, with strict rejection and non-strict/IGNORE truncation; generic opaque-state casts and explicit BINARY casts retain separate semantics. Same-type physical replay avoids repadding existing short BINARY data. Conditional expression coercion stays lossless before the actual destination assignment, and charset conversion retargets the assignment without rebinding stored decimal computation under a changed session.

The regressions cover literal and typed numeric inputs, zero-width assignment versus opaque casts, UTF-8 byte truncation, NULLs, failed-batch atomicity, COPY/default/generated expression behavior and IF/CASE results above 65,535 bytes. Adjacent fixtures retain their original feature oracles using valid-width data rather than bypassing the new capacity checks.

No blocking findings for this bounded stage. Reused latest-head successful CI and applicable source-bound unit/SQL evidence; no fresh local tests or predecessor-deployment qualification were run. This does not close the rest of #28164 or certify the historical mixed-version/QA claims in the description.

@XuPeng-SH

XuPeng-SH commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: d6400a6ed84e9312847f80f2e6d5708241405b86

Review completed. Read the assessment.

@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: d6400a6ed84e9312847f80f2e6d5708241405b86

Assessment: approve

The scoped binary fix reuses existing type-bound, assignment-cast and DDL replay owners. Prior protocol-gate, expression-width and retained-computation concerns are resolved.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed all 39 changed files and 70 discussion entries; source remains unchanged. Required review records are saved.

  • Fresh native build, 22 focused tests, all three owning Go suites, scoped vet, formatting and whitespace checks passed.

  • Allocator restart passed 100 race-enabled stress repetitions.

  • Seven exact BVT cases passed twice on one owned two-CN instance: 2,216 successes and three existing ignores per round, with teardown verified.

  • Direct JDBC metadata/value checks and the neighboring BINARY primary-key fixture passed. Baseline boundary controls failed as expected. Claims, logs and receipts are reconciled in validation-index.json.

Limitations:

  • Ten existing Go test skips; BVT metadata comparison uses CI's exclusion flag, with changed metadata checked separately.

  • The unchanged 20-million-row integer COPY test timed out locally; the full neighboring DDL case remains incomplete.

  • An extra reviewer CTAS assertion used an invalid expectation; its failed result and resolution are retained in metadata-analysis.json.

  • No formal QA or predecessor-binary migration certification; broader collation/ODKU issue #28164 remains outside this stage.

@XuPeng-SH

XuPeng-SH commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: d6400a6ed84e9312847f80f2e6d5708241405b86

Review linked issue or PR description changed before publication; a fresh contextual review is queued.

@XuPeng-SH

XuPeng-SH commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: d6400a6ed84e9312847f80f2e6d5708241405b86

New discussion was assessed; the previous review remains unchanged.

VioletQwQ-0 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

Decision needed: assignment width for legacy generated columns

The official v4.2.6 binary and a candidate built from tree 87b09cf7c91770eeef33f0ba8cc5d31ad49fc133 (the tree of current head d6400a6ed84e9312847f80f2e6d5708241405b86) were run sequentially against the same isolated store, with the old service stopped before the candidate started. The candidate binary was built from snapshot commit 777a203f1434921da55e31ca871d556a32d547d5, not from the current commit identity. For four legacy implicit/explicit generated-column tables, all 24 observed SQL outcomes, rows and warnings matched across versions: 15 successes and nine matching errors. This is an observed comparison, not a claim that all 24 statements succeeded.

One compatibility choice remains: in strict mode, a legacy implicit BINARY(4) generated column accepted and stored a six-byte result on both versions; a legacy implicit VARBINARY(8) similarly retained nine bytes. A newly created generated column in the candidate rejects the corresponding strict overflow. The legacy assignment-cast owner is unchanged versus the merge base. For the tested VARBINARY(8) example, the persisted expression bytes for the implicit assignment and an explicit user CAST were identical while their original SQL text differed; stripping all root casts would therefore be unsafe.

Please choose the intended contract for new writes to already-persisted legacy generated columns:

  1. Preserve the historical behavior for this change (recommended for the current compatibility repair): retain old stored data and its write behavior, explicitly documenting the existing over-width limitation and deciding its migration policy separately.
  2. Apply the new assignment rules to legacy columns after upgrade: reject overflow in strict mode and apply the supported non-strict/IGNORE behavior. This changes existing workload results and needs an explicit distinction between user casts and historical assignment wrapping, preservation of existing physical rows, and real predecessor fixtures covering both forms, SQL modes, character sets, COPY and rollback.

The stopped-upgrade comparison and its 24 observed outcomes are real-version evidence; mixed-version operation, downgrade, deployed QA, and the broader issue are not established by this result. The full raw fixture and logs are retained locally (archive SHA-256 dd51d72a687c8c04e02a9871f360981c403dfbd7d61a60051c5f06b2d756235b). This decision is separate from the outstanding reviewer questions and is not a request for re-review.

Reviewer-accessible version-pair evidence

The pinned selected version-pair evidence is available as an unlisted gist to anyone with the link. It includes the original per-scenario results, the frozen fixture runner, synthetic generated-expression bytes and release/store receipts. python3 verify.py checks their SHA-256 identities, preserved initial rows/catalog and all 24 matched status/row/warning observations; each side has 15 successes and 9 matching errors, and those errors remain errors.

The tested binary was built from snapshot 777a203f1434921da55e31ca871d556a32d547d5 with the same content tree as current head d6400a6ed84e9312847f80f2e6d5708241405b86; it was not built from that commit identity. This is selected evidence, not the full archive or a turnkey environment. It does not decide the legacy-width policy, establish mixed-version behavior or replace deployed QA.

@XuPeng-SH

XuPeng-SH commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: d6400a6ed84e9312847f80f2e6d5708241405b86

New discussion was assessed; the previous review remains unchanged.

@XuPeng-SH

XuPeng-SH commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: d6400a6ed84e9312847f80f2e6d5708241405b86

New discussion was assessed; the previous review remains unchanged.

@VioletQwQ-0

Copy link
Copy Markdown
Collaborator Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

❌ Left the queue · Matrixone CI execution / SCA Test on Linux/arm64 fails with this pull request

1 h 53 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 10 Nov, 06:48 · rule main · triggered by @VioletQwQ-0 with the @mergifyio queue command
  • ❌ Checks failed · in place
  • 🚫 Left the queue 08:41 · 817bd91

The failure is in this pull request. It failed tested alone on top of main.

Reason

The merge conditions cannot be satisfied due to failing checks

  • CI Required

Failing checks:

To get back in the queue

  • Push a fix: the pull request is queued again once its queue conditions match.
  • If the failure is a flake, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

Requeue requested — the merge queue status continues in this comment ↓.

2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

@mergify

mergify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

❌ Left the queue · Matrixone CI execution / UT Test on Ubuntu/x86 fails with this pull request

2 h 22 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 11 Nov, 07:57 · rule main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in place
  • 🚫 Left the queue 10:19 · 928f8aa

The failure is in this pull request. It failed tested alone on top of main.

Reason

The merge conditions cannot be satisfied due to failing checks

  • CI Required

Failing checks:

To get back in the queue

  • Push a fix: the pull request is queued again once its queue conditions match.
  • If the failure is a flake, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

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

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — 928f8aaf Deployed Nov 11, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working kind/documentation Improvements or additions to documentation kind/enhancement kind/feature kind/refactor Code refactor kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants