Repository navigation
Conversation
002858f to
3b9d0db
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
Merge Queue Status
This pull request spent 8 minutes 16 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull 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.
Failing checks:
HintYou 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. Tick the box to put this pull request back in the merge queue (same as
|
…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>
…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>
…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>
## 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]>
What type of PR is this?
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.
old __mo_rowid IS NULLsource, so conflict rows skip hidden delete/tokenize/insert while genuinely new rows in the same statement are still indexed.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:
3b9d0dbb22f8e6d911c8d9b3bf9e3585271a0cc5Current PR base used for the A/B:
c46d897e9645b80178568ef0783dd8e99e527222-count=1, 3 named tests selected).pkg/sql/plan: PASS (-count=1).gofmtandgit diff --check: PASS.PASS semantic=PASSfor the exact head and complete diff.Exact 600,000-base-row synthetic A/B
Run
mo55-600k-20260902T050254Zused mo-55 Linux/amd64 embedded single-CN with the supplied customer table shape: string primary key,TEXT, nullableVECF32(1536), ordinary composite index, and synchronous FULLTEXT withgojieba.VECF32(1536)values.INSERT ... ON DUPLICATE KEY UPDATE start_time=VALUES(start_time)changingstart_timefrom 1 to 2.chunk_textwas not assigned.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:
old __mo_rowid IS NULLand received 0 runtime rows.1,000 -> 0row-filter counter, so that exact operator counter remains a follow-up evidence gap.MATCHresult, and produced no duplicate visible posting group.system.statement_infodid 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/generationmapping, query-time live-map validation, and asynchronous stale-posting vacuum for changed indexed text.