Skip to content

perf(plan): backport ODKU FULLTEXT maintenance optimizations - #29219

Merged
aptend merged 4 commits into
matrixorigin:hotfix-20260922from
aptend:backport/28066-on-9572bd3
Sep 22, 2026
Merged

aptend merged 4 commits into
matrixorigin:hotfix-20260922from
aptend:backport/28066-on-9572bd3

Conversation

@aptend

@aptend aptend commented Sep 22, 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:

issue #27933

What this PR does / why we need it:

Backport the ODKU irregular-index routing from #27956, the synchronous FULLTEXT optimization from #28066, and the generated-key safety guard from #28076 to hotfix-20260922. This PR is independent of the VALUES fix in #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 9572bd3311abb16d1df939956408a727bcf83eba ./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.

Backport the ODKU irregular-index routing from matrixorigin#27956 and the value-aware synchronous FULLTEXT maintenance from matrixorigin#28066 onto hotfix-20260922.

The release branch lacks the newer INSERT ALL and ordered-ODKU planner machinery, so this adaptation computes generated-column dependency closure directly against the hotfix planner while preserving conservative fallback behavior.

(cherry picked from commit 5da2413)

(cherry picked from commit 6eee646)
@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 Sep 22, 2026
Match main while the local Iceberg E2E suite is stabilized; the Docker Hub minio/mc image used by this workflow is currently inaccessible.

(cherry picked from commit 70b8d18)

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

GPT-6 Astra medium deep review at exact head 4906066: REQUEST_CHANGES. [P1] Generated-primary-key changes can bypass synchronous FULLTEXT maintenance. In pkg/sql/plan/bind_insert.go around line 2780, dependency closure finds changed generated columns, but classification checks index-part/INCLUDE dependencies rather than document identity; this branch permits generated PK changes. A generated PK update can leave FULLTEXT postings under the old document identity while the row moves to the new PK, and the PK-inclusive equality path is not selected. Restore the dependency-aware immutable-PK guard or implement old-PK deletion plus new-PK insertion. [P2] Exact-head hotfix evidence is incomplete: attach revision-linked planner/package evidence and normal-comparison runs of both changed ODKU BVT cases, including teardown/rerun and a generated-PK regression. No additional confirmed defect was found in grouping, null transitions, unsupported-type fallback, or cleanup.

@aptend
aptend requested a review from XuPeng-SH September 22, 2026 06:13

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

GPT-6 Astra medium re-review at exact head 090ff78: REQUEST_CHANGES. [P2] Existing generated-column BVT still expects ON DUPLICATE KEY UPDATE a=5 with generated PK b=a*2 to succeed and produce (5,10), but the new immutable-key guard rejects it and preserves (1,2); update generated_column.result and run the normal-comparison case. [P2] The published exact-head validation is not attributable: the head/commands/case names are empty and the embedded build identifies unrelated commit 3e8f416; attach revision-linked commands, terminal reports, service identity, readiness/teardown, and same-instance comparison evidence. [P2] The implicit/generated-key contract lacks real planner-entry coverage; current helper tests manually provide changed columns and cannot prove seed/dependency expansion. Add explicit source to generated UNIQUE and implicit ON UPDATE to generated-key rejection cases plus an unrelated-update control. Historical generated-PK/FULLTEXT source defect is addressed.

@aptend
aptend requested a review from XuPeng-SH September 22, 2026 06:45

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

GPT-6 Astra medium re-review at exact head 38cb71f: REQUEST_CHANGES. Prior generated-PK/FULLTEXT implementation blockers are closed, including the corrected generated-column oracle and real planner-entry explicit/implicit dependency tests. [P2] The changed vector_ivfflat_include_dml_sync.sql contract has no reported execution evidence; run it in normal-comparison mode, verify teardown, and repeat on the same instance. [P2] The reported exact-head package/build and 439/439 BVT summaries still lack inspectable terminal reports, ISCP readiness evidence, and catalog teardown postconditions before reruns. Attach those records; hotfix branch-filtered CI and skipped Iceberg do not fill these gaps.

@aptend

aptend commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head validation artifacts for 38cb71fcc3add986f99786fa9b29f5c90d159181 are attached here:

https://gist.github.com/aptend/a548ee548f6436d0d5abcfccea9570c4

The gist contains the exact-head build output, package-test/vet/lint terminal logs, checksums, full mo-service.log, readiness record, and both named mo-tester reports. ISCP-Task Start was observed before the BVT runs. On the same service instance, generated_column.sql, on_duplicate_key_modern.sql, and vector_ivfflat_include_dml_sync.sql passed twice: 174/174 + 265/265 + 55/55 = 494/494 per round, runner exit 0. After each round, catalog postconditions recorded zero remaining generated/vector databases, generated/vector tables, and t_odku_% tables. The service then logged Shutdown complete and exited 0. The PR head was not changed after collecting this evidence.

@aptend
aptend requested a review from XuPeng-SH September 22, 2026 07:07

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

GPT-6 Astra medium force re-review: APPROVE. Reviewed all 18 changed files at exact head 38cb71f against base 9572bd3. Generated-key dependency closure and immutable PK/UNIQUE rejection, corrected generated-column oracle, real planner-entry tests, FULLTEXT identity/routing, and IVF INCLUDE maintenance are all closed. Inspected exact-head build/package/vet/lint/readiness and validation artifacts: generated-column 174, ODKU 265, IVF INCLUDE 55, 494/494 twice on the same instance, teardown counts zero, service log/manifest aligned and clean shutdown recorded. No blocking finding remains.

@aptend
aptend merged commit 96f9a63 into matrixorigin:hotfix-20260922 Sep 22, 2026
5 checks passed
@aptend aptend mentioned this pull request Sep 22, 2026
1 of 7 tasks
XuPeng-SH pushed a commit that referenced this pull request Nov 17, 2026
## 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:

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.

---------

Co-authored-by: 和光同尘 <[email protected]>
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.

3 participants