Skip to content

perf(plan): skip unchanged ODKU irregular maintenance - #27956

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-27933-odku-ft-maintenance
Sep 2, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-27933-odku-ft-maintenance

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Sep 1, 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 #27933

What this PR does / why we need it:

This is phase 1 of the ODKU FULLTEXT repair. The issue remains open for the phase-2 doc-id map and customer/QA closure.

  • Classifies synchronous irregular indexes from the final ODKU update set, grouping all physical definitions by logical index name and resolving aliased parts.
  • Keeps delete + final-image insert for affected groups.
  • Routes unaffected groups through one shared old __mo_rowid IS NULL source, so conflict rows skip hidden delete/tokenize/insert while genuinely new rows in the same statement are still indexed.
  • Preserves the existing generic index-plugin leaf builders; no FULLTEXT-specific planner dispatch, SQL/API, catalog, protocol, or storage-format change is introduced.
  • Prevents sink reduction from dropping the second input of a multi-input APPLY.

The correct plan shape for an unaffected FULLTEXT index still contains its tokenizer/insert leaf because compile time cannot know which input rows will be new. The invariant is that conflict rows do not enter that leaf, while fresh rows do.

Exact-head validation

Current exact head: 3b9d0dbb22f8e6d911c8d9b3bf9e3585271a0cc5
Current PR base used for the A/B: c46d897e9645b80178568ef0783dd8e99e527222

  • Focused planner routing/grouping/reducer tests: PASS (-count=1, 3 named tests selected).
  • Full pkg/sql/plan: PASS (-count=1).
  • gofmt and git diff --check: PASS.
  • Semantic preflight: PASS semantic=PASS for the exact head and complete diff.
  • Latest exact-head GitHub check runs: no failure, pending, or cancelled result. Shared build, Ubuntu/x86 UT, Linux/arm64 SCA, UT coverage, coverage, two BVT jobs, PR validity, planning, and Summary are SUCCESS; conditional jobs are SKIPPED and Mergify checks are NEUTRAL.
  • Review is still required; this PR remains Draft.

Exact 600,000-base-row synthetic A/B

Run mo55-600k-20260902T050254Z used mo-55 Linux/amd64 embedded single-CN with the supplied customer table shape: string primary key, TEXT, nullable VECF32(1536), ordinary composite index, and synchronous FULLTEXT with gojieba.

  • Loaded exactly 600,000 base rows before creating the ordinary index and FULLTEXT.
  • All 600,000 rows used non-NULL VECF32(1536) values.
  • Actual hidden-table size was 7,800,000 posting rows, or 13 postings/document on average.
  • The timed SQL was a real 1,000-row, 100%-conflict INSERT ... ON DUPLICATE KEY UPDATE start_time=VALUES(start_time) changing start_time from 1 to 2. chunk_text was not assigned.
  • No ANN index or IVF/HNSW/CAGRA maintenance node existed.
  • One warm-up was excluded and all three measured repetitions were retained.
Scenario PR base raw / median PR head raw / median
A: no FULLTEXT 1.872500s / 1.851630s / 1.196436s; median 1.851630s 3.249840s / 1.383546s / 4.632685s; median 3.249840s
B: FULLTEXT 4.464175s / 367.471028s / 399.003311s; median 367.471028s 4.469246s / 6.755056s / 5.100114s; median 5.100114s

Scenario B improved by 72.05x at the median, with a 98.61% elapsed-time reduction. The 4.464175s parent outlier was retained. The slowest parent statement was 399.003311s (about 6m39s), so this experiment did not reproduce a single 12-minute statement.

Plan and correctness evidence:

  • The PR-base plan contains the FULLTEXT hidden delete/scan path, 17 hidden physical data-source references, and tokenizer/insert maintenance.
  • The PR-head plan has no hidden delete/scan for this scalar update; the generic tokenizer/insert path remains behind old __mo_rowid IS NULL and received 0 runtime rows.
  • EXPLAIN did not expose the expected explicit 1,000 -> 0 row-filter counter, so that exact operator counter remains a follow-up evidence gap.
  • All 12 measured cells updated exactly 1,000 rows, retained 600,000 base rows, preserved 7,800,000 postings and the 1,000-document MATCH result, and produced no duplicate visible posting group.
  • system.statement_info did not publish the tagged statements within 60 seconds. Statement/transaction IDs, rows read, and bytes scanned are unknown and are not claimed as zero.

This is single-host synthetic mechanism evidence. Parent ran before head, so cache/order effects remain a limitation. It is not equivalent to the customer topology or workload, and customer root cause remains NOT_CONFIRMED.

Historical development evidence

On pre-rebase head 34a7d5cfc706ddb3142866d3f566392ea6434474, a task-exclusive embedded matrix passed 42/42 synthetic cells. On a later controlled variable-size matrix, the baseline payload-only case grew with unrelated posting-table size while the phase-one plan removed the hidden delete/scan for the unaffected update. These are historical mechanism checks, not substitutes for current-head customer QA.

Remaining work and scope boundary

QA is still required on the exact deployed build, original SQL, original 1,000-row input, matching snapshot, topology, storage backend, and concurrency. QA must capture statement/operator rows and bytes scanned/written. Timeouts, OOMs, skipped cells, or synthetic-only results do not close the issue.

Phase 2 remains out of scope for this PR: versioned source PK -> current docid/generation mapping, query-time live-map validation, and asynchronous stale-posting vacuum for changed indexed text.

@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Sep 1, 2026
@mergify mergify Bot added kind/bug Something isn't working kind/enhancement kind/test-ci labels Sep 1, 2026

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

Deep review completed on exact head 3b9d0db.

The phase-1 optimization is correct and scoped to the confirmed cause: synchronous irregular-index delete/rebuild is skipped for conflict rows when neither index parts nor plugin-owned dependencies change, while genuinely new rows still receive insert maintenance.

Counterexamples checked: all-conflict, all-new, mixed conflict/new batches, multiple independent and multipart fulltext indexes, generated and ON UPDATE columns, IVFFLAT INCLUDE columns, async index groups, rollback/replay, and multi-input APPLY sink reduction. The old RowID marker cleanly separates conflict from new rows, logical index definitions stay grouped, and the reducer guard preserves non-sink APPLY inputs.

Performance risk is bounded: classification is planner-only and insert-only indexes share one filtered materialization per target table. The exact-head Linux UT, SCA, coverage, and BVT jobs are green; diff check is clean. Local focused UT was unavailable only because this isolated macOS worktree lacks a matching cgo/libmo.dylib.

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

mergify Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-02 11:49 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-02 11:57 UTC · at 21ae646d301b1752b9600ac04589421952334e19

This pull request spent 8 minutes 16 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 #27956 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.

Failing checks:

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

@XuPeng-SH
XuPeng-SH merged commit 5da2413 into matrixorigin:main Sep 2, 2026
20 of 21 checks passed
@mergify mergify Bot added dequeued and removed queued labels Sep 2, 2026
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…7956)

## 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:

This is phase 1 of the ODKU FULLTEXT repair. The issue remains open for
the phase-2 doc-id map and customer/QA closure.

- Classifies synchronous irregular indexes from the final ODKU update
set, grouping all physical definitions by logical index name and
resolving aliased parts.
- Keeps delete + final-image insert for affected groups.
- Routes unaffected groups through one shared `old __mo_rowid IS NULL`
source, so conflict rows skip hidden delete/tokenize/insert while
genuinely new rows in the same statement are still indexed.
- Preserves the existing generic index-plugin leaf builders; no
FULLTEXT-specific planner dispatch, SQL/API, catalog, protocol, or
storage-format change is introduced.
- Prevents sink reduction from dropping the second input of a
multi-input `APPLY`.

The correct plan shape for an unaffected FULLTEXT index still contains
its tokenizer/insert leaf because compile time cannot know which input
rows will be new. The invariant is that conflict rows do not enter that
leaf, while fresh rows do.

### Exact-head validation

Current exact head: `3b9d0dbb22f8e6d911c8d9b3bf9e3585271a0cc5`  
Current PR base used for the A/B:
`c46d897e9645b80178568ef0783dd8e99e527222`

- Focused planner routing/grouping/reducer tests: PASS (`-count=1`, 3
named tests selected).
- Full `pkg/sql/plan`: PASS (`-count=1`).
- `gofmt` and `git diff --check`: PASS.
- Semantic preflight: `PASS semantic=PASS` for the exact head and
complete diff.
- Latest exact-head GitHub check runs: no failure, pending, or cancelled
result. Shared build, Ubuntu/x86 UT, Linux/arm64 SCA, UT coverage,
coverage, two BVT jobs, PR validity, planning, and Summary are SUCCESS;
conditional jobs are SKIPPED and Mergify checks are NEUTRAL.
- Review is still required; this PR remains Draft.

### Exact 600,000-base-row synthetic A/B

Run `mo55-600k-20260902T050254Z` used mo-55 Linux/amd64 embedded
single-CN with the supplied customer table shape: string primary key,
`TEXT`, nullable `VECF32(1536)`, ordinary composite index, and
synchronous FULLTEXT with `gojieba`.

- Loaded exactly 600,000 base rows before creating the ordinary index
and FULLTEXT.
- All 600,000 rows used non-NULL `VECF32(1536)` values.
- Actual hidden-table size was 7,800,000 posting rows, or 13
postings/document on average.
- The timed SQL was a real 1,000-row, 100%-conflict `INSERT ... ON
DUPLICATE KEY UPDATE start_time=VALUES(start_time)` changing
`start_time` from 1 to 2. `chunk_text` was not assigned.
- No ANN index or IVF/HNSW/CAGRA maintenance node existed.
- One warm-up was excluded and all three measured repetitions were
retained.

| Scenario | PR base raw / median | PR head raw / median |
|---|---:|---:|
| A: no FULLTEXT | 1.872500s / 1.851630s / 1.196436s; median 1.851630s |
3.249840s / 1.383546s / 4.632685s; median 3.249840s |
| B: FULLTEXT | 4.464175s / 367.471028s / 399.003311s; median
**367.471028s** | 4.469246s / 6.755056s / 5.100114s; median
**5.100114s** |

Scenario B improved by 72.05x at the median, with a 98.61% elapsed-time
reduction. The 4.464175s parent outlier was retained. The slowest parent
statement was 399.003311s (about 6m39s), so this experiment did not
reproduce a single 12-minute statement.

Plan and correctness evidence:

- The PR-base plan contains the FULLTEXT hidden delete/scan path, 17
hidden physical data-source references, and tokenizer/insert
maintenance.
- The PR-head plan has no hidden delete/scan for this scalar update; the
generic tokenizer/insert path remains behind `old __mo_rowid IS NULL`
and received 0 runtime rows.
- EXPLAIN did not expose the expected explicit `1,000 -> 0` row-filter
counter, so that exact operator counter remains a follow-up evidence
gap.
- All 12 measured cells updated exactly 1,000 rows, retained 600,000
base rows, preserved 7,800,000 postings and the 1,000-document `MATCH`
result, and produced no duplicate visible posting group.
- `system.statement_info` did not publish the tagged statements within
60 seconds. Statement/transaction IDs, rows read, and bytes scanned are
unknown and are not claimed as zero.

This is single-host synthetic mechanism evidence. Parent ran before
head, so cache/order effects remain a limitation. It is not equivalent
to the customer topology or workload, and customer root cause remains
`NOT_CONFIRMED`.

### Historical development evidence

On pre-rebase head `34a7d5cfc706ddb3142866d3f566392ea6434474`, a
task-exclusive embedded matrix passed 42/42 synthetic cells. On a later
controlled variable-size matrix, the baseline payload-only case grew
with unrelated posting-table size while the phase-one plan removed the
hidden delete/scan for the unaffected update. These are historical
mechanism checks, not substitutes for current-head customer QA.

### Remaining work and scope boundary

QA is still required on the exact deployed build, original SQL, original
1,000-row input, matching snapshot, topology, storage backend, and
concurrency. QA must capture statement/operator rows and bytes
scanned/written. Timeouts, OOMs, skipped cells, or synthetic-only
results do not close the issue.

Phase 2 remains out of scope for this PR: versioned `source PK ->
current docid/generation` mapping, query-time live-map validation, and
asynchronous stale-posting vacuum for changed indexed text.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…7956)

## 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:

This is phase 1 of the ODKU FULLTEXT repair. The issue remains open for
the phase-2 doc-id map and customer/QA closure.

- Classifies synchronous irregular indexes from the final ODKU update
set, grouping all physical definitions by logical index name and
resolving aliased parts.
- Keeps delete + final-image insert for affected groups.
- Routes unaffected groups through one shared `old __mo_rowid IS NULL`
source, so conflict rows skip hidden delete/tokenize/insert while
genuinely new rows in the same statement are still indexed.
- Preserves the existing generic index-plugin leaf builders; no
FULLTEXT-specific planner dispatch, SQL/API, catalog, protocol, or
storage-format change is introduced.
- Prevents sink reduction from dropping the second input of a
multi-input `APPLY`.

The correct plan shape for an unaffected FULLTEXT index still contains
its tokenizer/insert leaf because compile time cannot know which input
rows will be new. The invariant is that conflict rows do not enter that
leaf, while fresh rows do.

### Exact-head validation

Current exact head: `3b9d0dbb22f8e6d911c8d9b3bf9e3585271a0cc5`  
Current PR base used for the A/B:
`c46d897e9645b80178568ef0783dd8e99e527222`

- Focused planner routing/grouping/reducer tests: PASS (`-count=1`, 3
named tests selected).
- Full `pkg/sql/plan`: PASS (`-count=1`).
- `gofmt` and `git diff --check`: PASS.
- Semantic preflight: `PASS semantic=PASS` for the exact head and
complete diff.
- Latest exact-head GitHub check runs: no failure, pending, or cancelled
result. Shared build, Ubuntu/x86 UT, Linux/arm64 SCA, UT coverage,
coverage, two BVT jobs, PR validity, planning, and Summary are SUCCESS;
conditional jobs are SKIPPED and Mergify checks are NEUTRAL.
- Review is still required; this PR remains Draft.

### Exact 600,000-base-row synthetic A/B

Run `mo55-600k-20260902T050254Z` used mo-55 Linux/amd64 embedded
single-CN with the supplied customer table shape: string primary key,
`TEXT`, nullable `VECF32(1536)`, ordinary composite index, and
synchronous FULLTEXT with `gojieba`.

- Loaded exactly 600,000 base rows before creating the ordinary index
and FULLTEXT.
- All 600,000 rows used non-NULL `VECF32(1536)` values.
- Actual hidden-table size was 7,800,000 posting rows, or 13
postings/document on average.
- The timed SQL was a real 1,000-row, 100%-conflict `INSERT ... ON
DUPLICATE KEY UPDATE start_time=VALUES(start_time)` changing
`start_time` from 1 to 2. `chunk_text` was not assigned.
- No ANN index or IVF/HNSW/CAGRA maintenance node existed.
- One warm-up was excluded and all three measured repetitions were
retained.

| Scenario | PR base raw / median | PR head raw / median |
|---|---:|---:|
| A: no FULLTEXT | 1.872500s / 1.851630s / 1.196436s; median 1.851630s |
3.249840s / 1.383546s / 4.632685s; median 3.249840s |
| B: FULLTEXT | 4.464175s / 367.471028s / 399.003311s; median
**367.471028s** | 4.469246s / 6.755056s / 5.100114s; median
**5.100114s** |

Scenario B improved by 72.05x at the median, with a 98.61% elapsed-time
reduction. The 4.464175s parent outlier was retained. The slowest parent
statement was 399.003311s (about 6m39s), so this experiment did not
reproduce a single 12-minute statement.

Plan and correctness evidence:

- The PR-base plan contains the FULLTEXT hidden delete/scan path, 17
hidden physical data-source references, and tokenizer/insert
maintenance.
- The PR-head plan has no hidden delete/scan for this scalar update; the
generic tokenizer/insert path remains behind `old __mo_rowid IS NULL`
and received 0 runtime rows.
- EXPLAIN did not expose the expected explicit `1,000 -> 0` row-filter
counter, so that exact operator counter remains a follow-up evidence
gap.
- All 12 measured cells updated exactly 1,000 rows, retained 600,000
base rows, preserved 7,800,000 postings and the 1,000-document `MATCH`
result, and produced no duplicate visible posting group.
- `system.statement_info` did not publish the tagged statements within
60 seconds. Statement/transaction IDs, rows read, and bytes scanned are
unknown and are not claimed as zero.

This is single-host synthetic mechanism evidence. Parent ran before
head, so cache/order effects remain a limitation. It is not equivalent
to the customer topology or workload, and customer root cause remains
`NOT_CONFIRMED`.

### Historical development evidence

On pre-rebase head `34a7d5cfc706ddb3142866d3f566392ea6434474`, a
task-exclusive embedded matrix passed 42/42 synthetic cells. On a later
controlled variable-size matrix, the baseline payload-only case grew
with unrelated posting-table size while the phase-one plan removed the
hidden delete/scan for the unaffected update. These are historical
mechanism checks, not substitutes for current-head customer QA.

### Remaining work and scope boundary

QA is still required on the exact deployed build, original SQL, original
1,000-row input, matching snapshot, topology, storage backend, and
concurrency. QA must capture statement/operator rows and bytes
scanned/written. Timeouts, OOMs, skipped cells, or synthetic-only
results do not close the issue.

Phase 2 remains out of scope for this PR: versioned `source PK ->
current docid/generation` mapping, query-time live-map validation, and
asynchronous stale-posting vacuum for changed indexed text.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…7956)

## 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:

This is phase 1 of the ODKU FULLTEXT repair. The issue remains open for
the phase-2 doc-id map and customer/QA closure.

- Classifies synchronous irregular indexes from the final ODKU update
set, grouping all physical definitions by logical index name and
resolving aliased parts.
- Keeps delete + final-image insert for affected groups.
- Routes unaffected groups through one shared `old __mo_rowid IS NULL`
source, so conflict rows skip hidden delete/tokenize/insert while
genuinely new rows in the same statement are still indexed.
- Preserves the existing generic index-plugin leaf builders; no
FULLTEXT-specific planner dispatch, SQL/API, catalog, protocol, or
storage-format change is introduced.
- Prevents sink reduction from dropping the second input of a
multi-input `APPLY`.

The correct plan shape for an unaffected FULLTEXT index still contains
its tokenizer/insert leaf because compile time cannot know which input
rows will be new. The invariant is that conflict rows do not enter that
leaf, while fresh rows do.

### Exact-head validation

Current exact head: `3b9d0dbb22f8e6d911c8d9b3bf9e3585271a0cc5`  
Current PR base used for the A/B:
`c46d897e9645b80178568ef0783dd8e99e527222`

- Focused planner routing/grouping/reducer tests: PASS (`-count=1`, 3
named tests selected).
- Full `pkg/sql/plan`: PASS (`-count=1`).
- `gofmt` and `git diff --check`: PASS.
- Semantic preflight: `PASS semantic=PASS` for the exact head and
complete diff.
- Latest exact-head GitHub check runs: no failure, pending, or cancelled
result. Shared build, Ubuntu/x86 UT, Linux/arm64 SCA, UT coverage,
coverage, two BVT jobs, PR validity, planning, and Summary are SUCCESS;
conditional jobs are SKIPPED and Mergify checks are NEUTRAL.
- Review is still required; this PR remains Draft.

### Exact 600,000-base-row synthetic A/B

Run `mo55-600k-20260902T050254Z` used mo-55 Linux/amd64 embedded
single-CN with the supplied customer table shape: string primary key,
`TEXT`, nullable `VECF32(1536)`, ordinary composite index, and
synchronous FULLTEXT with `gojieba`.

- Loaded exactly 600,000 base rows before creating the ordinary index
and FULLTEXT.
- All 600,000 rows used non-NULL `VECF32(1536)` values.
- Actual hidden-table size was 7,800,000 posting rows, or 13
postings/document on average.
- The timed SQL was a real 1,000-row, 100%-conflict `INSERT ... ON
DUPLICATE KEY UPDATE start_time=VALUES(start_time)` changing
`start_time` from 1 to 2. `chunk_text` was not assigned.
- No ANN index or IVF/HNSW/CAGRA maintenance node existed.
- One warm-up was excluded and all three measured repetitions were
retained.

| Scenario | PR base raw / median | PR head raw / median |
|---|---:|---:|
| A: no FULLTEXT | 1.872500s / 1.851630s / 1.196436s; median 1.851630s |
3.249840s / 1.383546s / 4.632685s; median 3.249840s |
| B: FULLTEXT | 4.464175s / 367.471028s / 399.003311s; median
**367.471028s** | 4.469246s / 6.755056s / 5.100114s; median
**5.100114s** |

Scenario B improved by 72.05x at the median, with a 98.61% elapsed-time
reduction. The 4.464175s parent outlier was retained. The slowest parent
statement was 399.003311s (about 6m39s), so this experiment did not
reproduce a single 12-minute statement.

Plan and correctness evidence:

- The PR-base plan contains the FULLTEXT hidden delete/scan path, 17
hidden physical data-source references, and tokenizer/insert
maintenance.
- The PR-head plan has no hidden delete/scan for this scalar update; the
generic tokenizer/insert path remains behind `old __mo_rowid IS NULL`
and received 0 runtime rows.
- EXPLAIN did not expose the expected explicit `1,000 -> 0` row-filter
counter, so that exact operator counter remains a follow-up evidence
gap.
- All 12 measured cells updated exactly 1,000 rows, retained 600,000
base rows, preserved 7,800,000 postings and the 1,000-document `MATCH`
result, and produced no duplicate visible posting group.
- `system.statement_info` did not publish the tagged statements within
60 seconds. Statement/transaction IDs, rows read, and bytes scanned are
unknown and are not claimed as zero.

This is single-host synthetic mechanism evidence. Parent ran before
head, so cache/order effects remain a limitation. It is not equivalent
to the customer topology or workload, and customer root cause remains
`NOT_CONFIRMED`.

### Historical development evidence

On pre-rebase head `34a7d5cfc706ddb3142866d3f566392ea6434474`, a
task-exclusive embedded matrix passed 42/42 synthetic cells. On a later
controlled variable-size matrix, the baseline payload-only case grew
with unrelated posting-table size while the phase-one plan removed the
hidden delete/scan for the unaffected update. These are historical
mechanism checks, not substitutes for current-head customer QA.

### Remaining work and scope boundary

QA is still required on the exact deployed build, original SQL, original
1,000-row input, matching snapshot, topology, storage backend, and
concurrency. QA must capture statement/operator rows and bytes
scanned/written. Timeouts, OOMs, skipped cells, or synthetic-only
results do not close the issue.

Phase 2 remains out of scope for this PR: versioned `source PK ->
current docid/generation` mapping, query-time live-map validation, and
asynchronous stale-posting vacuum for changed indexed text.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
aptend added a commit that referenced this pull request Sep 22, 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:

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
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]>
@VioletQwQ-0
VioletQwQ-0 deleted the codex/issue-27933-odku-ft-maintenance branch December 1, 2026 03:47

This branch was previously deployed

1 inactive deployment
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 kind/enhancement kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants