Repository navigation
Conversation
9598358 to
33f02f4
Compare
Review: Approve ✅This is a well-evidenced performance optimization that correctly defers position decoding in One minor suggestion
On corrupt data ( // Returns the number of docs actually decoded. On corrupt block data this may
// be less than blockLen(b); callers must use the return value as the valid
// slice length rather than assuming all blockLen(b) slots are populated.This matches the defensive pattern already used in VerdictApprove. The optimization is architecturally sound, the lazy-decode invariant is correctly tested, and the only actionable item is documenting the partial-return semantics to prevent future misuse. |
33f02f4 to
a8e9eff
Compare
a8e9eff to
c6e039f
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-approving exact head after fixing the Mergify commit-message metadata: the required ## What this PR does / why we need it: section is now present and the PR title has been shortened.
|
@Mergifyio queue main |
Merge Queue Status
This pull request spent 1 hour 3 minutes 28 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27165 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
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [x] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #25541 ## What this PR does / why we need it: This is a bounded backport of the FULLTEXT2 behavior closure from the fixed `upstream/main` reference to `4.2-dev`. It keeps FULLTEXT2 distinct from classic FULLTEXT and preserves the target branch's parser/PERFORM/pipe contracts. Source/target closure: - source `upstream/main`: `8e616a693458652cc26b3c4be45c6602dff298d4` - target `upstream/4.2-dev`: `d2393868a7aaa6343518d80849fe4696aa3577e9` - exact fork head: `325686d29c17b3729f32b837b5bc2144d33f0a9b` - #25904 core: `966acb2a92bb740e57b0b7a181df2d21956e1d3`, `0eb9a921ece274c956447640b41ad2a255079e8d`, `403a99fb65304e75b82e75793448f0690a871d0e`, `bfa83f42737ca6304c0af3f6913e70ccc961464` - #27165 phrase-position decode: `2b142144c3c24a2100d7d313e952717025d56aeb` - #27171 FT2-only wrapped score/range closure: `835e046faa9242dbe288bd72364a475e2132bbed` - #27461/#27462 cache and cold-load closure: `e4abf5e90d0b5e09590571ca78447e50806527c` - #27598 readiness BVT closure: `e3a7440e2ac32bac780669f33c656960e22cff22` Current-head review repairs: - Reverse constant-left `<`/`<=` before harvesting a lower-bound MATCH membership driver; reject constant-left `>`/`>=` upper bounds fail-closed. - Route all FULLTEXT2 ISCP consumer errors through the non-blocking helper and report `ctx.Err()` on cancellation. - Restore the execution-level `fulltext2_wrapped_score.sql/.result` BVT pair and replace restore/clone fixed sleeps with readiness waits. - Refresh the ancestor-accurate backport manifest and clear all `git diff --check` trailing whitespace findings. - Trim FULLTEXT2 SHOW CREATE option padding only at the terminal output boundary, preserving the shared renderer and vector-index behavior. - Route wrapped-only FULLTEXT2 score predicates on either INNER JOIN child through the existing wrapped rewrite and keep the score comparison in a post-rewrite FILTER. ## Validation - `make -C pkg/sql/parsers/dialect/mysql` — PASS - `make generate-pb` — PASS; protoc 29.3 descriptor-only churn was discarded and no unexpected generated diff remains - `go test -mod=readonly ./pkg/fulltext2/... ./pkg/iscp ./pkg/sql/plan` — PASS - current-head focused `GOWORK=off go test -mod=readonly -count=1 -timeout 120s -run '^TestFulltext2WrappedMatchJoinChild$' ./pkg/sql/plan` — PASS - current-head `GOWORK=off go test -mod=readonly -count=1 ./pkg/sql/plan` — PASS - current-head `GOWORK=off go build -mod=readonly ./pkg/sql/plan` and `GOWORK=off go vet -mod=readonly ./pkg/sql/plan` — PASS - current-head SCA repair — removed the unreferenced `applyJoinFullTextIndices` wrapper; targeted plan tests, build, and vet pass; exact-head remote SCA is pending - current-head focused SHOW CREATE regression and catalog option tests — PASS - local `mo-cgo-test` wrapper — BLOCKED by missing `cgo/libmo.dylib`; no CGo wrapper pass is claimed - `go test -race -mod=readonly ./pkg/fulltext2/... ./pkg/iscp` — PASS - `go build -mod=readonly ./cmd/mo-service` — PASS (macOS linker rpath/path warnings only) - base differential — exact target `d2393868a7aaa6343518d80849fe4696aa3577e9` rejects `CREATE FULLTEXT2 INDEX`; this exact head parses it as `INDEX_CATEGORY_FULLTEXT2` - BVT source parity and no-fixed-sleep scan — PASS - canonical wrapped-score BVT now covers wrapped-only MATCH on both INNER JOIN child positions with qualifying and rejecting thresholds; exact-head remote BVT remains pending - exact-head semantic preflight — `PASS semantic=PASS`, diff hash `efc51153938b14e051372026b296c06e05696385ac674fa7f05f3a7217741d09` ## Scope and acceptance boundaries - `QA required: yes` - The PR was opened as Draft for preflight and is now **Ready for review**. Required CI, formal reviews, and Mergify remain pending; no remote pass is claimed until they bind to this exact head. - Build success, index creation/readiness, and elapsed workload duration are not acceptance by themselves. No classic FULLTEXT result, fixed-commit product acceptance claim, or formal QPS claim is used here. - The 2.3M frozen corpus and shared `freetier-01` workload remain post-merge gates. After merge, only the official immutable image/release workflow may produce the tag/digest; `freetier-01` must be upgraded through the reviewed GitOps `environment=new-dev + mode=mo + action=set` PR. No local image, direct `4.2-dev` push, direct GitOps edit, kubectl mutation, or pod restart is authorized. - The first post-release test is a unique-database 15-minute small-corpus FULLTEXT2 shakeout with readiness polling, token-bucket DML, C1/C10 readers, and an independent correctness ledger. Only `MEASURED_PASS` with zero correctness errors, no backlog, and complete observations may unlock the low-load two-hour continuous run. Please keep issue #25541 open until QA explicitly reports PASS/FAIL. --------- Co-authored-by: Eric Lam <[email protected]> Co-authored-by: XuPeng-SH <[email protected]>
…rigin#27165) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes issue matrixorigin#27155 ## What this PR does / why we need it: Defer FULLTEXT2 phrase-position decoding until document alignment, so sparse phrase intersections avoid decoding position blocks that are never inspected while preserving query results and existing index behavior. ## Summary Positional FULLTEXT2 phrase cursors previously decoded document ordinals, term frequencies, and positions together while aligning posting lists. Sparse phrase intersections therefore decoded position blocks that were never inspected. This change separates document-block and position-block state. `doc()` and `skipTo()` decode document ordinals only; positions are decoded only after all phrase cursors align on a common document. Existing query-local phrase buffers are reused and the unused phrase-TF scratch is removed. WAND remains on the existing `fillBlock` path, and single-slot/prefix phrases retain their existing fallback. There is no SQL, DDL, index-format, FST, CDC, runtime-filter, scoring, or membership change. ## Correctness and lifecycle - Differential phrase-cursor tests compare document ordinals and phrase TF with the materialized evaluator for build-side and serialized loaded segments. - Lazy-decode tests prove that `doc()` and `skipTo()` leave the position block undecoded. - Sparse-intersection and table-function tests exercise the production search entry point. - Results copy ordinal/TF scalars and do not alias pooled buffers; early missing-term paths retain deferred buffer release. - WAND parity, focused race, full FULLTEXT2 race, and dependent table-function tests pass. ## Validation on current main Base: `matrixorigin/matrixone@8b5dd17` Head: `c6e039fdafd4f3ed67891ac64f5d7a042be73046` Passed: ```text go test ./pkg/fulltext2/... ./pkg/sql/colexec/table_function/... go test -race ./pkg/fulltext2/... go build ./cmd/mo-service go vet ./pkg/fulltext2/... ./pkg/sql/colexec/table_function/... git diff --check semantic preflight: PASS ``` ## Latest-main 2.3M-document A/B The same-host paired run used 2,303,643 documents, the same read-only positional gojieba FULLTEXT2 index, and fixed query packs: - `natural_normal`: 200 queries, SHA-256 `f6ce089380452686462329a91b48da58e19d9399ec57ddc9c12fd8f224852934` - `natural_mixed`: 188 queries, SHA-256 `a73f75109c0d460d020f2c587aec997fc7edd47150b46633535511cf28f91e94` - `boolean_must`: 200 queries, SHA-256 `a5794b5e4c78513ae97098354d90da704d04ddbb1fd5d697599f1f3d876915bd` The benchmark binaries were built from `A-main@8c34dc9` and `C-phrase@a8e9eff`; the intervening upstream commit and the rebase-only commit do not touch FULLTEXT2, docfilter, or the FULLTEXT planner/plugin paths. The published PR head is the rebased `c6e039f`. Correctness preflight passed all 82 selected differential queries with identical PK membership and float32 score bits. All 10 performance cells completed with zero errors and zero timeouts. The host was shared, so absolute QPS/P99 are not published; these are paired direction results only and are marked `PERF_INCONCLUSIVE_HOST_BUSY`. | Workload | Candidate / main QPS | Candidate / main P99 | Repeat spread | |---|---:|---:|---:| | natural_normal | **2.939x** | **0.155x** | 2.66% | | natural_mixed | **2.689x** | **0.159x** | 3.65% | | boolean_must control | **0.969x** | **1.054x** | single control | The run used 15 seconds of warmup and 60 seconds of measurement per cell, with alternating A/C order. Gate: PASS. ## Historical evidence The earlier 30-cell same-host run on the same corpus passed 588/588 query-pair membership and float32 score comparisons and reported Natural Normal 2.41x C1 / 3.01x C10, Natural Mixed 2.11x C1 / 2.72x C10, and Boolean MUST C10 0.979x. That run supplies broader C1/C10 and full-query evidence; the current run binds the direction to this rebased head. ## BVT and QA QA required. Production entry point: positional FULLTEXT2 `MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE)`. The PR is ready for review after the current-head checks complete; no SQL or public interface changes are included. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…rigin#27165) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes issue matrixorigin#27155 ## What this PR does / why we need it: Defer FULLTEXT2 phrase-position decoding until document alignment, so sparse phrase intersections avoid decoding position blocks that are never inspected while preserving query results and existing index behavior. ## Summary Positional FULLTEXT2 phrase cursors previously decoded document ordinals, term frequencies, and positions together while aligning posting lists. Sparse phrase intersections therefore decoded position blocks that were never inspected. This change separates document-block and position-block state. `doc()` and `skipTo()` decode document ordinals only; positions are decoded only after all phrase cursors align on a common document. Existing query-local phrase buffers are reused and the unused phrase-TF scratch is removed. WAND remains on the existing `fillBlock` path, and single-slot/prefix phrases retain their existing fallback. There is no SQL, DDL, index-format, FST, CDC, runtime-filter, scoring, or membership change. ## Correctness and lifecycle - Differential phrase-cursor tests compare document ordinals and phrase TF with the materialized evaluator for build-side and serialized loaded segments. - Lazy-decode tests prove that `doc()` and `skipTo()` leave the position block undecoded. - Sparse-intersection and table-function tests exercise the production search entry point. - Results copy ordinal/TF scalars and do not alias pooled buffers; early missing-term paths retain deferred buffer release. - WAND parity, focused race, full FULLTEXT2 race, and dependent table-function tests pass. ## Validation on current main Base: `matrixorigin/matrixone@8b5dd17` Head: `c6e039fdafd4f3ed67891ac64f5d7a042be73046` Passed: ```text go test ./pkg/fulltext2/... ./pkg/sql/colexec/table_function/... go test -race ./pkg/fulltext2/... go build ./cmd/mo-service go vet ./pkg/fulltext2/... ./pkg/sql/colexec/table_function/... git diff --check semantic preflight: PASS ``` ## Latest-main 2.3M-document A/B The same-host paired run used 2,303,643 documents, the same read-only positional gojieba FULLTEXT2 index, and fixed query packs: - `natural_normal`: 200 queries, SHA-256 `f6ce089380452686462329a91b48da58e19d9399ec57ddc9c12fd8f224852934` - `natural_mixed`: 188 queries, SHA-256 `a73f75109c0d460d020f2c587aec997fc7edd47150b46633535511cf28f91e94` - `boolean_must`: 200 queries, SHA-256 `a5794b5e4c78513ae97098354d90da704d04ddbb1fd5d697599f1f3d876915bd` The benchmark binaries were built from `A-main@8c34dc9` and `C-phrase@a8e9eff`; the intervening upstream commit and the rebase-only commit do not touch FULLTEXT2, docfilter, or the FULLTEXT planner/plugin paths. The published PR head is the rebased `c6e039f`. Correctness preflight passed all 82 selected differential queries with identical PK membership and float32 score bits. All 10 performance cells completed with zero errors and zero timeouts. The host was shared, so absolute QPS/P99 are not published; these are paired direction results only and are marked `PERF_INCONCLUSIVE_HOST_BUSY`. | Workload | Candidate / main QPS | Candidate / main P99 | Repeat spread | |---|---:|---:|---:| | natural_normal | **2.939x** | **0.155x** | 2.66% | | natural_mixed | **2.689x** | **0.159x** | 3.65% | | boolean_must control | **0.969x** | **1.054x** | single control | The run used 15 seconds of warmup and 60 seconds of measurement per cell, with alternating A/C order. Gate: PASS. ## Historical evidence The earlier 30-cell same-host run on the same corpus passed 588/588 query-pair membership and float32 score comparisons and reported Natural Normal 2.41x C1 / 3.01x C10, Natural Mixed 2.11x C1 / 2.72x C10, and Boolean MUST C10 0.979x. That run supplies broader C1/C10 and full-query evidence; the current run binds the direction to this rebased head. ## BVT and QA QA required. Production entry point: positional FULLTEXT2 `MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE)`. The PR is ready for review after the current-head checks complete; no SQL or public interface changes are included. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…rigin#27165) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes issue matrixorigin#27155 ## What this PR does / why we need it: Defer FULLTEXT2 phrase-position decoding until document alignment, so sparse phrase intersections avoid decoding position blocks that are never inspected while preserving query results and existing index behavior. ## Summary Positional FULLTEXT2 phrase cursors previously decoded document ordinals, term frequencies, and positions together while aligning posting lists. Sparse phrase intersections therefore decoded position blocks that were never inspected. This change separates document-block and position-block state. `doc()` and `skipTo()` decode document ordinals only; positions are decoded only after all phrase cursors align on a common document. Existing query-local phrase buffers are reused and the unused phrase-TF scratch is removed. WAND remains on the existing `fillBlock` path, and single-slot/prefix phrases retain their existing fallback. There is no SQL, DDL, index-format, FST, CDC, runtime-filter, scoring, or membership change. ## Correctness and lifecycle - Differential phrase-cursor tests compare document ordinals and phrase TF with the materialized evaluator for build-side and serialized loaded segments. - Lazy-decode tests prove that `doc()` and `skipTo()` leave the position block undecoded. - Sparse-intersection and table-function tests exercise the production search entry point. - Results copy ordinal/TF scalars and do not alias pooled buffers; early missing-term paths retain deferred buffer release. - WAND parity, focused race, full FULLTEXT2 race, and dependent table-function tests pass. ## Validation on current main Base: `matrixorigin/matrixone@8b5dd17` Head: `c6e039fdafd4f3ed67891ac64f5d7a042be73046` Passed: ```text go test ./pkg/fulltext2/... ./pkg/sql/colexec/table_function/... go test -race ./pkg/fulltext2/... go build ./cmd/mo-service go vet ./pkg/fulltext2/... ./pkg/sql/colexec/table_function/... git diff --check semantic preflight: PASS ``` ## Latest-main 2.3M-document A/B The same-host paired run used 2,303,643 documents, the same read-only positional gojieba FULLTEXT2 index, and fixed query packs: - `natural_normal`: 200 queries, SHA-256 `f6ce089380452686462329a91b48da58e19d9399ec57ddc9c12fd8f224852934` - `natural_mixed`: 188 queries, SHA-256 `a73f75109c0d460d020f2c587aec997fc7edd47150b46633535511cf28f91e94` - `boolean_must`: 200 queries, SHA-256 `a5794b5e4c78513ae97098354d90da704d04ddbb1fd5d697599f1f3d876915bd` The benchmark binaries were built from `A-main@8c34dc9` and `C-phrase@a8e9eff`; the intervening upstream commit and the rebase-only commit do not touch FULLTEXT2, docfilter, or the FULLTEXT planner/plugin paths. The published PR head is the rebased `c6e039f`. Correctness preflight passed all 82 selected differential queries with identical PK membership and float32 score bits. All 10 performance cells completed with zero errors and zero timeouts. The host was shared, so absolute QPS/P99 are not published; these are paired direction results only and are marked `PERF_INCONCLUSIVE_HOST_BUSY`. | Workload | Candidate / main QPS | Candidate / main P99 | Repeat spread | |---|---:|---:|---:| | natural_normal | **2.939x** | **0.155x** | 2.66% | | natural_mixed | **2.689x** | **0.159x** | 3.65% | | boolean_must control | **0.969x** | **1.054x** | single control | The run used 15 seconds of warmup and 60 seconds of measurement per cell, with alternating A/C order. Gate: PASS. ## Historical evidence The earlier 30-cell same-host run on the same corpus passed 588/588 query-pair membership and float32 score comparisons and reported Natural Normal 2.41x C1 / 3.01x C10, Natural Mixed 2.11x C1 / 2.72x C10, and Boolean MUST C10 0.979x. That run supplies broader C1/C10 and full-query evidence; the current run binds the direction to this rebased head. ## BVT and QA QA required. Production entry point: positional FULLTEXT2 `MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE)`. The PR is ready for review after the current-head checks complete; no SQL or public interface changes are included. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes
issue #27155
What this PR does / why we need it:
Defer FULLTEXT2 phrase-position decoding until document alignment, so sparse phrase intersections avoid decoding position blocks that are never inspected while preserving query results and existing index behavior.
Summary
Positional FULLTEXT2 phrase cursors previously decoded document ordinals, term frequencies, and positions together while aligning posting lists. Sparse phrase intersections therefore decoded position blocks that were never inspected.
This change separates document-block and position-block state.
doc()andskipTo()decode document ordinals only; positions are decoded only after all phrase cursors align on a common document. Existing query-local phrase buffers are reused and the unused phrase-TF scratch is removed. WAND remains on the existingfillBlockpath, and single-slot/prefix phrases retain their existing fallback.There is no SQL, DDL, index-format, FST, CDC, runtime-filter, scoring, or membership change.
Correctness and lifecycle
doc()andskipTo()leave the position block undecoded.Validation on current main
Base:
matrixorigin/matrixone@8b5dd17ca10699f966b8c22ecbf65f6c6b250217Head:
c6e039fdafd4f3ed67891ac64f5d7a042be73046Passed:
Latest-main 2.3M-document A/B
The same-host paired run used 2,303,643 documents, the same read-only positional gojieba FULLTEXT2 index, and fixed query packs:
natural_normal: 200 queries, SHA-256f6ce089380452686462329a91b48da58e19d9399ec57ddc9c12fd8f224852934natural_mixed: 188 queries, SHA-256a73f75109c0d460d020f2c587aec997fc7edd47150b46633535511cf28f91e94boolean_must: 200 queries, SHA-256a5794b5e4c78513ae97098354d90da704d04ddbb1fd5d697599f1f3d876915bdThe benchmark binaries were built from
A-main@8c34dc9andC-phrase@a8e9eff; the intervening upstream commit and the rebase-only commit do not touch FULLTEXT2, docfilter, or the FULLTEXT planner/plugin paths. The published PR head is the rebasedc6e039f.Correctness preflight passed all 82 selected differential queries with identical PK membership and float32 score bits. All 10 performance cells completed with zero errors and zero timeouts. The host was shared, so absolute QPS/P99 are not published; these are paired direction results only and are marked
PERF_INCONCLUSIVE_HOST_BUSY.The run used 15 seconds of warmup and 60 seconds of measurement per cell, with alternating A/C order. Gate: PASS.
Historical evidence
The earlier 30-cell same-host run on the same corpus passed 588/588 query-pair membership and float32 score comparisons and reported Natural Normal 2.41x C1 / 3.01x C10, Natural Mixed 2.11x C1 / 2.72x C10, and Boolean MUST C10 0.979x. That run supplies broader C1/C10 and full-query evidence; the current run binds the direction to this rebased head.
BVT and QA
QA required. Production entry point: positional FULLTEXT2
MATCH ... AGAINST (... IN NATURAL LANGUAGE MODE). The PR is ready for review after the current-head checks complete; no SQL or public interface changes are included.