Skip to content

[4.2.1-hotfix] backport VALUES and ODKU index maintenance fixes - #32861

Merged
XuPeng-SH merged 2 commits into
matrixorigin:v4.2.1-hotfixfrom
aptend:fix/v4.2.1-hotfix-values-odku-20261117
Nov 17, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:v4.2.1-hotfixfrom
aptend:fix/v4.2.1-hotfix-values-odku-20261117

Conversation

@aptend

@aptend aptend commented Nov 17, 2026

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 #29214 and #27933.

What this PR does / why we need it:

Backport #29218 and #29219 from the independent 4.2-hotfix-20260922 line to v4.2.1-hotfix. Both cherry-picks apply without conflicts; their 20 delivered files are identical to the source hotfix. Omit the unrelated temporary Iceberg CI disable carried by #29218.

  • Resolve one common type across an entire VALUES column, preserving DECIMAL precision/scale, NULLs, character widths and VECF64 precision; reject mismatched vector dimensions independently of row order.
  • Skip synchronous irregular-index maintenance for ODKU conflicts whose indexed columns cannot change. Classic FULLTEXT also skips rebuilds when the final stored text is equal. New rows, changed indexed values, unsupported proof types and plugins retain maintenance; generated-key dependency guards and IVF INCLUDE payload updates are preserved.

No catalog, index-storage or protocol migration is introduced. These optimizations do not claim to fix the cost of changed-text posting deletion or ordinary INSERT workloads.

Validation (Linux/amd64, Go 1.26.4, CGO):

  • make thirdparties, make cgo, release make build GOBUILD_OPT=-p=4: PASS.
  • Focused regression selection and full normal suites for pkg/sql/plan and pkg/fulltext/plugin/plan: PASS. pkg/indexplugin/plan compiles successfully and has no test files.
  • Official mo-tester comparison, twice on the same isolated service: VALUES 26/26, ODKU 265/265, generated columns 174/174 and IVF INCLUDE DML 55/55; 520/520 per run, no failed/ignored/abnormal statements.
  • Local SCA covers all 141 changed/reverse-dependent packages, including tests: go vet -mod=readonly -p=4 <closure> PASS; repository-pinned golangci-lint 2.6.2 run --new-from-rev=origin/main <closure> and the same check against 4711b18e82 PASS (0 issues). molint check -mod=readonly -p=4 <closure> has no new findings: its two unchanged unsafe-recover diagnostics reproduce identically on clean base 4711b18e82 with the same binary and package closure.
  • gofmt and git diff --check: PASS.

aptend and others added 2 commits November 17, 2026 18:13
…gin#29218)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#29214

## What this PR does / why we need it:

Backport matrixorigin#29215 to `hotfix-20260922`.

The VALUES planner previously derived types row by row while
materializing `VALUE_SCAN`. That made the result depend on row order and
could truncate values, lose precision, or select a type that could not
represent every row.

This PR resolves one order-independent common type for each VALUES
column before materialization:

- preserves DECIMAL precision and scale across all rows;
- types bare `NULL` values consistently, including all-NULL columns;
- uses the maximum declared width for mixed `CHAR`/`VARCHAR` values;
- preserves `VECF64` when mixed with `VECF32` and string literals,
independently of row order;
- rejects inconsistent vector dimensions across the complete column
domain;
- preserves already-homogeneous domains such as `GEOMETRY`, including
columns containing `NULL`;
- uses a DECIMAL domain when mixed signed/unsigned integers cannot fit
one integer type.

The change is scoped to VALUES planning and does not alter global
expression coercion such as `COALESCE`. It is adapted to the v4.2.1 type
model without bringing newer main-only PAD SPACE protobuf and
cast-overload dependencies into the hotfix branch.

Regression coverage includes planner unit tests and distributed VALUES
cases for reversed row order, mixed widths and numeric domains, NULL
placement, all-NULL columns, DECIMAL scale, vector
permutations/dimensions, and homogeneous GEOMETRY.

The PR also carries main's temporary local Iceberg E2E disable while the
workflow's Docker Hub dependency is unavailable.

### Validation

Validated exact head `263e5b16be92602921218ce799c9c9a671d0d98d`:

- `make build`: PASS; `./mo-service -version` reports branch
`fix/v4.2.1-hotfix-20260916-values`, commit `263e5b16be`.
- `GOWORK=off go test -count=1 -timeout=10m ./pkg/sql/plan`: PASS
(`4.473s`).
- `GOWORK=off go vet ./pkg/sql/plan`: PASS.
- `golangci-lint run -c .golangci.yml --new-from-rev
9572bd3 ./pkg/sql/plan`: PASS (`0
issues`).
- Fresh launch reached SQL readiness on `127.0.0.1:6001` after 5
seconds; `select version(), 1` returned
`8.0.30-MatrixOne-v4.2.120260916, 1`.
- Same-instance normal comparison: `./run.sh -n -g -t 2 -p
test/distributed/cases/dml/select/values.sql -s
test/distributed/resources`; run 1: `26/26`, run 2: `26/26`, both 100%,
no failed/ignored/abnormal cases.
- The service terminated cleanly after the rerun (`Shutdown complete`,
exit 0).

Full MatrixOne PR CI/BVT is not scheduled by the current workflow
because its branch filter does not include base branch
`hotfix-20260922`.

(cherry picked from commit fe0f106)
…rigin#29219)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#27933

## What this PR does / why we need it:

Backport the ODKU irregular-index routing from matrixorigin#27956, the synchronous
FULLTEXT optimization from matrixorigin#28066, and the generated-key safety guard
from matrixorigin#28076 to `hotfix-20260922`. This PR is independent of the VALUES
fix in matrixorigin#29218.

For `INSERT ... ON DUPLICATE KEY UPDATE` on tables with classic
synchronous FULLTEXT indexes:

- unchanged conflict rows skip hidden FULLTEXT delete, tokenization, and
insert work;
- new rows and rows whose indexed values change continue through the
existing maintenance path;
- all physical definitions of one logical irregular index stay in the
same routing group;
- comparisons include row identity and supported indexed text columns
and use null-safe equality;
- unsupported types, unknown plugins, asynchronous indexes, and
incomplete metadata conservatively retain the original maintenance path.

The backport also expands explicit assignments and implicit `ON UPDATE`
columns through generated-column dependencies before primary/unique-key
and irregular-index classification. An ODKU that can change a generated
primary or unique key is rejected before maintenance can use a stale
document identity; unrelated assignments remain supported.

Hotfix-specific adaptation:

- this release line has no newer `INSERT ALL` planner path, so no
corresponding change is included;
- this release line predates ordered ODKU assignments, so dependency
closure is computed from the hotfix planner's final explicit and
implicit assignment set.

Regression coverage includes real planner-entry tests for explicit and
implicit generated-UNIQUE dependencies, an unrelated-update control,
sink-consumer plan invariants, and distributed generated-column/ODKU
cases. Existing FULLTEXT and vector-index maintenance coverage is
retained.

The PR also carries main's temporary local Iceberg E2E disable while the
workflow's Docker Hub dependency is unavailable.

### Validation

Validated exact head `38cb71fcc3add986f99786fa9b29f5c90d159181`:

- `make build`: PASS; `./mo-service -version` reports branch
`backport/28066-on-9572bd3`, commit `38cb71fcc3`.
- `GOWORK=off go test -count=1 -timeout=10m ./pkg/sql/plan
./pkg/fulltext/plugin/plan`: PASS (`4.552s`, `0.043s`).
- `GOWORK=off go vet ./pkg/sql/plan ./pkg/fulltext/plugin/plan
./pkg/indexplugin/plan`: PASS.
- `golangci-lint run -c .golangci.yml --new-from-rev
9572bd3 ./pkg/sql/plan
./pkg/fulltext/plugin/plan ./pkg/indexplugin/plan`: PASS (`0 issues`).
- Fresh launch reached SQL readiness on `127.0.0.1:6001` after 11
seconds; `select version(), 1` returned `8.0.30-MatrixOne-v2806695723,
1`.
- Same-instance normal comparison, run twice with `./run.sh -n -g -t 2`:
`generated_column.sql` passed `174/174` in both runs;
`on_duplicate_key_modern.sql` passed `265/265` in both runs. Each
combined run was `439/439`, 100%, with no failed/ignored/abnormal cases.
- The service terminated cleanly after the rerun (`Shutdown complete`,
exit 0).

Full MatrixOne PR CI/BVT is not scheduled by the current workflow
because its branch filter does not include base branch
`hotfix-20260922`.

---------

Co-authored-by: 和光同尘 <[email protected]>
(cherry picked from commit 96f9a63)
@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 →

@mergify mergify Bot added kind/bug Something isn't working kind/enhancement kind/test-ci labels Nov 17, 2026
@mergify

mergify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH
XuPeng-SH merged commit 9df4a8e into matrixorigin:v4.2.1-hotfix Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants