Repository navigation
fulltext2: reuse prefix iterator posting offsets - #29696
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of b0cdac6 against dce6063: REQUEST_CHANGES for one outstanding validation gate. No blocking correctness defect was confirmed in the six-file patch.
[P2] Complete the explicitly retained paired-query performance acceptance.
The PR's Review sequencing section makes current-head paired 188-query measurements and representative nonempty/high-hit non-regression checks merge gates. Its current evidence still stops during the first candidate cell because of the preserved disk floor. The prefix-enumeration benchmark supports lower allocation (108,408 -> 67,128 B/op), and frozen query/score-bit digests support semantic parity, but neither is the promised complete paired-query runtime/non-regression result. Supply the completed, comparable baseline/M1 results under the same corpus, selectors, scorer, build and machine, including nonempty mixed-phrase/dense controls; explain any material regression. Historical/interrupted cells must stay separate. This does not require full TKE weekly integration before review and does not request changes to the measurement resource floor.
Implementation and design:
- This is a focused optimization of an existing traversal contract, not a new algorithm/storage/lifecycle feature requiring an additional design document.
- The iterator already yields the same posting-directory offset used by LookupLoaded. Direct decoding reuses decodeTermEntry and its bounds, retains dictionary order and MAX-over-expanded-term scoring, and preserves the positional merge and dense-prefix bitset.
- All three changed production callers were traced, including the unchanged exact lookup, build-side PrefixRange, phrase fallback, global DF/liveness and serializer/loaded representation. The unsigned offset bound also precedes int conversion.
- No second index format, decoder, cache, background worker or scoring path is introduced.
| Closure | Result |
|---|---|
| Q1 ownership | Iterator closes through defer on completion/error; term strings are owned copies; posting views remain within the existing segment/cache lifetime. Query materialization does not mutate shared loaded metadata. |
| Q2 termination | Finite iterator traversal, synchronous callbacks, no new wait/retry dependency; iterator errors retain the callers' existing error disposition. |
| Q3 live memory | Removes the expanded-term slice/second FST lookup; existing per-query bitmap/position materialization remains. The dense positional path is not falsely claimed bounded to a small constant. |
Test/QA assessment:
Read every changed hunk and the complete 319-line test addition plus SQL/result delta. Built/heap/mmap parity, BM25/TfIdf score bits, scored/unscored/weighted clauses, independent literal-start TF, malformed offset, update/delete visibility and concurrent readers cover distinct boundaries. Small fixtures and the new nonempty SQL control are appropriate; the benchmark is explicitly separate from functional assertions. Reused the author's exact-content full package/race/stress and loaded-corpus evidence; no duplicate full suite was launched. Whitespace passes.
The latest CI Required run 37757547715 is successful; the superseded failure from run 37743249778 is not a current CI blocker. There are no prior substantive review threads. Production delta is +68/-42, tests/results +330/-2, docs 0. The code review is favorable; the formal decision remains request changes until the PR's outstanding performance acceptance is completed.
Exact-head performance supplement — M1 v5 (2026-10-09)Following the performance validation request from @XuPeng-SH, the current-head controlled series has now completed 28/28 cells, with phase Frozen experiment
All three pairs (no interrupted/historical cells included)
*Pair2 is an unstable baseline observation, not a trustworthy53% optimization claim. Full-pack baseline spread is62.58%, M1 spread1.65%; the complete three-pair timing series fails the15% stability criterion. Nonempty baseline/M1 spreads are3.86%/2.08% and pass. The host's697 vmstat samples show average iowait17.8%, maximum68%, with brief swap activity; these describe interference risk, not proven causality for pair2. We retain all pairs and do not discard pair2 to manufacture a passing stable series. First/third-pair24.3–24.6% reductions are observations, not a certified whole-pack speedup. The evidence validator checks exact source, packet and selector identities, all configured requests/query coverage,10 loaded segments, variant identities and result-count/per-query equivalence. Earlier frozen loaded-index complete PK/TF/score-bit parity remains separate correctness evidence. Go allocated bytes/request improve consistently (full-pack baseline ~1.7446MB vs M1 ~1.2972MB); this does not cover native allocations or imply equivalent RSS reduction. Test-only direction probes (not production changes)P=missing-exact precheck, S=streaming. Four variants were run once for each control; they are not a stable algorithm ranking.
The zero-result improvements follow P; S alone does not improve these representatives. Single-prefix dense controls intentionally retain the existing dense fast path, so near-identical results do not validate streaming on dense mixed phrases. All four variants here run on the candidate head: this table does not provide a baseline/M1 dense/high-hit non-regression pair. Empty-query results cannot be generalized to the packet or nonempty/high-hit traffic. P/S remain outside this PR. Remaining review/QA gates
The latest exact-head CI 37757547715 is SUCCESS, including CI Required and Ubuntu UT. It supersedes the previously described CI blocker, without proving the root cause of the older context-canceled failure. PR Ready state and head are unchanged. Evidence identity and retention
|
Response to performance CR — completed exact-head v6 controls@XuPeng-SH, this supplies the outstanding paired-query/non-regression evidence from your P2 review. There is no new production commit: candidate remains Requirement-by-requirement closure
All v6 measurements
Measured scope: native Linux/amd64 Go1.27.0, shared mo-55, original100k documents in ten loaded10k segments, ngram/natural_mixed, positional BM25/TopK100, C1/GOMAXPROCS4 search-only. Same fixed-count harness, all selected queries warmed and >=10s warmup per fresh process. There are18 measurement cells/255,360 requests and two separate full-result mixed-phrase oracle executions. All expected queries/cycles completed, count digests were independently reconstructed, and final frozen-wrapper/input/binary/index checks passed. The complete frozen packet is predominantly zero-result on this subset (186/188 queries), which is why separate nonempty/high-hit controls are retained. This closes the previously missing repeatable scoped kernel comparison; it is not clean-host, 180-second SQL/nightly QPS, full-corpus or TKE QA acceptance. Host monitoring recorded mean idle87.3%, mean iowait4.45%, max iowait13%. Other users' work was not stopped or modified. Stable paired timing does not imply an exclusively owned server. Runtime/provenance/terminal evidenceThe original native build records and hashes are reused, rather than recompiling. Both worktree tracked contents are clean at their pinned SHA; test-only untracked harness files are explicitly retained. Go build metadata, immutable test-binary hashes, harness/input manifests and all ten segment hashes are recorded and rechecked. The new run-active and terminal retained unit records bind actual limits: aggregate6GiB memory, MemorySwapMax0, CPU400%, RuntimeMax45min, stop15s, KillModecontrol-group. Continuous guard/sampler remained alive through every cell and were joined at exit. Six hundred capacity samples stayed above memory10GiB/disk20GiB floors, with zero additional host swap-out; the20GiB floor is the previously authorized reserve relaxation. Peak task memory1,493,839,872 bytes (~1.39GiB); memory.events has zero OOM/kill/max events. Completion is PASS/complete/exit0, MainPID0/Resultsuccess. Independent inspection found the exact task cgroup absent, stopped only the retained owned unit, and confirmed post-stop cgroup absence. No source, corpus, index, raw result or foreign resource was deleted. The independent metrics validator has eight passing regression tests covering wrong source/digest, incomplete requests, score mismatch, insufficient high-hit DF, unstable timing and visible regression. Its verdict keeps run completion, timing stability and observed non-regression separate; reviewer acceptance is not inferred from a wrapper PASS. Evidence identity / retention
Latest exact-head CI37757547715 is SUCCESS. Required developer performance controls are now supplied for re-review; formal CHANGES_REQUESTED is not dismissed or self-resolved. Artifact-only TKE focused/weekly remains later QA/NOT_RUN, as distinguished in your review. Ready/head unchanged. No129 contact/workload, no TKE dispatch, no automatic retry, and no merge/queue admission. |
|
Follow-up cleanup pushed as
The v6 performance response remains bound to measured head Current-head CI will be reported separately; the older successful run is not relabeled as current-head CI. The outstanding formal review is left to the reviewer, and TKE QA remains pending. No 129/TKE or new mo-55 experiment was launched for this cleanup. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of b8a50bd against merge-base 4942f88. APPROVE. Reviewed directly, without subagents.
The previous P2 paired-query performance requirement is closed by the v6 evidence: #29696 (comment) . All three alternating pairs complete the frozen 188-query pack and the independently selected high-hit mixed-phrase and dense single-prefix controls. Reported within-arm spread is below 0.21%; observed elapsed reductions are 24.22–24.43%, 18.67–18.78% and 38.23–38.32%, respectively. The mixed control has live DF172, matching full PK/TF/score-bit oracles and TopK100 in both arms. The previously unstable v5 result and candidate-only factorial experiments are correctly kept separate.
Evidence scope is explicit: measured baseline dce6063 and candidate b0cdac6, Linux/amd64 Go1.27.0, 100k original documents/ten segments, C1/GOMAXPROCS4, search-only. I verified the subsequent FULLTEXT2 changes only move unchanged legacy collectors into test code; search, decoder, index/writer and scoring bodies remain unchanged, and the current base integration does not change that algorithm. The measured behavior is reusable for this scoped optimization. Those numerical results are author-supplied historical-binary evidence, not a fresh Go1.27.1 benchmark, full SQL/TP throughput, clean-host certification, full-corpus or TKE QA claim. No new remote workload was run by this review.
Design/ownership: read every hunk in all six files and traced all three production callers, the unchanged exact lookup and FST serializer, build/heap/mmap representations, global DF, phrase fallback, update/delete liveness and cache/segment lifetime. The writer stores the same posting-directory offset returned by FST iteration; both paths use the existing decodeTermEntry. The unsigned bounds check precedes conversion to int. Dictionary order, MAX-over-expanded-term scoring, TF/position semantics and the existing single-prefix bitmap are preserved. There is no new format, cache, state machine, decoder or execution owner.
Unhappy paths: iterator Close is deferred for exhaustion and errors; strings are owned copies; transient posting views remain inside the existing segment/cache lifetime. Error results are discarded by the same boolean/phrase owners. Traversal and callbacks are synchronous and finite, with no new waits or retries. Removing term collection and redundant FST.Get reduces work; dense positional materialization remains an acknowledged existing cost, not a claimed constant-size bound.
Independent boundary challenge and test quality: the empty/absent/multi-CJK prefixes and malformed MaxUint64 offset are checked against the unchanged exact-lookup path; built/heap/mmap results, both scorers, weighting/unscored clauses, literal-start TF and update/delete visibility have distinct oracles. Concurrent-reader and race evidence remains applicable to unchanged production bodies. The current exact-head CI run 37968177551 selects pkg/fulltext2 in the light -race stage and finishes with status 0. Its Compose artifact explicitly executes fulltext2_cjk_boolean_prefix.sql: 33/33 passed, zero failures/ignored/abnormal. The earlier 100-repeat reader stress is reused; no redundant full suite was launched.
Increment: implementation 3 files +60/-64; tests/fixtures 3 files +362/-2; documentation 0. Of the test growth, 31 lines are the relocated independent legacy collectors, not new coverage or a net-code reduction. Retiring them from production is appropriate because their remaining consumers are the oracle/benchmark; retaining PrefixRange is necessary for the live build-side path. Small fixtures and the nonempty public SQL control cover actual changed behavior. No remaining blocking comment, correctness defect, lifecycle issue or unjustified complexity was established. Full deployment/TKE QA remains outside this code-review approval.
Merge Queue Status
This pull request spent 6 minutes 53 seconds in the queue, with no time running CI. ReasonPull request #29696 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.
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. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #29205 (partial optimization; does not close the issue).
What this PR does / why we need it:
M1 reuses the posting-directory offset already returned by the loaded FST prefix iterator, avoiding a second exact-key FST lookup. It retains dictionary traversal order, positional merging, the dense-prefix bitset, MAX-over-expanded-term scoring, and the existing index format. No metadata decoder, streaming search, missing-term shortcut, or BOW algorithm change is included.
Regression coverage compares built, heap-loaded and mmap-loaded representations, BM25/TfIdf score bits, scored/unscored prefix clauses, mixed star/exact phrases, update/delete visibility, malformed offsets and concurrent readers. A literal-start oracle checks mixed-phrase TF independently. A SQL BVT adds a nonempty mixed CJK prefix phrase.
Current-head evidence binding after upstream CI cleanup fix
Head
b8a50bd121d104061cc13e55bade0a11ef6af239normally merges upstream main4942f889ef08ae26b2ebeb02a1eda11634eb83fd, including the shardservice listener/constructor cleanup fixes in #29708 and #29676. The M1 FULLTEXT2 and tokenizer source is unchanged from4640004eae5294dc8c0964d260868edb507df1f0; the final feature delta remains the same six files. No independent shardservice patch or P/S prototype was added to this PR.Fresh native Darwin/ARM64 Go1.27.1 checks on the merged tree: full FULLTEXT2 package with vet (319 top-level tests), full package race with vet (318), concurrent-reader race stress (100 repetitions), and full shardservice package with vet under short/matrixone_test/set-coverage conditions (73) all PASS. The targeted TestRead/TestServiceCloseListener/TestServiceCloseErrors coverage run also PASS. The local coverage scope is four related packages, not the all-repository Linux CI scope. Whitespace checks PASS. Required new-head remote CI remains pending; no rerun of the known failing old head was requested. Prior SQL BVT and v5/v6 measurements remain bound to
b0cdac6e303f9723fed075f45040f7cbd9e8e02d/ Go1.27.0 and are reused only for unchanged behavior, not relabeled as Go1.27.1 or current-head binary measurements. DF172 means high-hit, not high-density mixed-phrase coverage. No new remote experiment was run for this synchronization.Current-head CI disposition
Run37911762603 attempt1, prior head4640004e: FAILURE, retained as historical evidence. The UT Coverage job fails at
pkg/shardservice/TestReadwith a Goetty listener leak-check failure, causing the aggregate coverage and CI Required failures. Ordinary Ubuntu UT, shared build, SCA, executed Compose PROXY and Pessimistic BVT jobs are SUCCESS.Source attribution is now established: the old head starts
remote.serverbut never closes it in service.Close, while its fixture calls leaktest.AfterTest immediately instead of deferring it. Issue #29709 records the same listener leak / TestRead failure independently of M1. PR #29708, merged asca5008de9aa1569504d593350ed92059217c85e4, fixes endpoint cleanup and the fixture; #29676 adds construction ownership/idempotent Close. Both are present in the new merged main. This is a known independent lifecycle defect, not a failure declared flaky from an ARM64 pass. Fresh local tests support the repair, but new exact-head Linux CI is still required.New-head MatrixOne ALL CI run37968177551, head
b8a50bd121d104061cc13e55bade0a11ef6af239: attempt1 FAILURE; attempt2 IN_PROGRESS; required CI is not green. Attempt1 shared build, Ubuntu UT Coverage, merged Coverage and both Compose PROXY/Pessimistic BVT jobs succeeded. SCA job113947837893 and Ubuntu UT job113947837905 failed during actions/checkout with interrupted Git transport/peer termination (UT also reports curl receive error56/early EOF), before their analysis/test commands executed; CI Required failed its dependency AND gate. This is a checkout/setup failure, not an SCA finding or a product test failure. After inspecting every completed failure and verifying the unchanged OPEN Ready exact head, only failed jobs were retried once. Attempt2 UT job113972071978 and SCA job113972072235 are now running; no code was changed for the retry, and no old-head run was retried. The original run was triggered by the normal push, not manual dispatch.Validation on the prior measured head b0cdac6 (reused for unchanged behavior)
pkg/fulltext2tests: PASS (319 top-level tests).git diff --check: PASS.context canceled; the later success alone does not establish its root cause.Historical v5 controlled performance supplement (2026-10-09)
Completed continuation v5 on shared mo-55: candidate
b0cdac6e303f9723fed075f45040f7cbd9e8e02d, baselinedce60631f8c857ae730a4d2f328df5962e4f2a8d, native Linux/amd64 Go1.27.0, loaded100k corpus in ten10k segments, frozen188-query ngram natural_mixed pack, search-only, C1/GOMAXPROCS4. Fixed-count measurements, not 180-second SQL/nightly QPS. Three alternating baseline→M1 / M1→baseline / baseline→M1 pairs; every full-pack cell completes22,560 requests, every nonempty control cell completes10,000 requests.Go allocated bytes/request decrease25.64–25.65% for the full pack and29.25% for the nonempty control. All28 configured cells returned PASS; phase reached complete/exit0, final frozen hashes passed, unit exited successfully/MainPID0, peak cgroup memory1.55GiB. Validator checks source/input/variant/request coverage and result-count equivalence. Earlier loaded-index PK/score-bit parity is separate correctness evidence, not inferred from timing.
Classification: PASS_EXPLORATORY, full-pack timing stability INCONCLUSIVE. Baseline full-pack spread62.58% versus M1 spread1.65%; nonempty spreads3.86%/2.08% pass the15% stability check. During the full run, host vmstat recorded average iowait17.8% and maximum68%. This establishes interference risk, not the precise cause of pair2. Pair2 is retained explicitly, not silently dropped to manufacture a stable series. No clean-host/full SQL/nightly acceptance is claimed.
The16 factorial cells are single-pass, test-only direction probes on the M1 head. P=missing-exact precheck; S=streaming. Empty-query gains primarily follow P, not S alone. Nonempty and dense-prefix controls remain nonempty across all variants. The dense control has no baseline-arm pair in this run, and is not the required baseline/M1 high-hit non-regression evidence. P/S are not part of this PR and are not approved for production by these results.
Raw evidence retained under mo-55 task root
ft2-m1-delivery-20261008T073424Z/performance-evidence-v5; previous v1-v3 interrupted evidence remains separate. Sanitized detailed metrics and identity hashes are in the accompanying PR comment.Measured-head CR performance supplement v6 (2026-10-09)
Fresh BC/CB/BC pairs on the same frozen baseline/candidate binaries and original100k/ten-segment index completed18 measurement cells/255,360 requests, plus two independent full-result high-hit mixed-phrase oracle executions. No new production commit or rebuild.
All groups pass the original15% stability criterion: maximum within-arm spread0.202%. High-hit mixed phrase has live global DF172 and matching complete baseline/M1 PK/TF/score-bit digests; both it and the paired dense single-prefix control return TopK100 on every measured request. Stable v5 one-hit mixed controls and unchanged exact-head CI/race/BVT evidence are reused. The old unstable v5 pack and candidate-only factorial controls remain historical exploratory evidence, not passing halves of v6.
Same native Linux/amd64 Go1.27.0, ngram/natural_mixed, BM25/TopK100, C1/GOMAXPROCS4, search-only/fixed-count/warmup contract. This is repeatable scoped kernel performance evidence on shared mo-55, not exclusive-host, full230万-corpus,180-second SQL/nightly or TKE QA acceptance. The packet is predominantly zero-result on this subset; independent nonempty/high-hit controls prevent presenting it as high-density coverage.
Runtime receipts retain active/terminal6GiB/noSwap/CPU400%/45min/stop15s/control-group limits. Guard600 samples, no additional swap-out, all capacity floors satisfied, zero OOM/kill/max events, task peak1.39GiB, completion/exit0, guard/sampler joined, exact cgroup absent and retained owned unit stopped. Frozen binaries/inputs/index verified before/after. Raw results remain in the private v6 evidence directory; metrics, identities and requirements are in the CR response comment.
QA required / evidence still pending
QA required: yes. Loaded-index parity, real SQL BVT, repeatable v6 full-pack comparisons and actual paired high-hit mixed/single-prefix controls are complete on measured head b0cdac6 and reused only for unchanged behavior. Formal reviewer acceptance, new-head required CI, current Go1.27.1 binary performance and Artifact-only TKE focused/weekly QA remain pending. The old coverage failure has the upstream lifecycle-fix disposition described above, not a retroactive PASS. V6 supplies the missing scoped developer performance evidence; v5's unstable timing and incomplete dense comparison remain accurately classified. Earlier v3 stopped below its25GiB disk floor and remains excluded; v5 used the author's explicit20GiB disk-reserve relaxation with all other resource/ownership gates unchanged.
The first measurement wrapper was stopped after finding a selector-scoping defect, before dense probes ran. Its successor regression proves all four variants retain the same dense control and caller selector state. Original interrupted evidence is preserved. Only this task's reproducible Go caches were reclaimed; corpus, indexes, binaries, source and evidence remain intact.
Measured baseline is dce6063 and measured candidate is b0cdac6. The delivery-time main snapshot1a008879 advanced only Go1.27.1 and associated documentation, not FULLTEXT2/native code; it is historical, not today's main. Experimental v5/v6 evidence remains frozen on those measured binaries and Go1.27.0. The current head merges main4942f889 and uses Go1.27.1; historical measurements are not current-head acceptance. Dense prefix/position materialization remains intentionally unchanged.
Self-review checked callback/mmap lifetime, iterator close/error handling, offset bounds, traversal/scoring order and all changed callers. The experimental precheck/streaming harness is intentionally excluded from this PR.
Review sequencing
Ready for code review at the author's request; not full QA/merge acceptance. The v6 measured-head188-query series is complete and time-stable across all three pairs; actual high-hit mixed and dense single-prefix baseline/M1 controls also pass. These developer performance requirements are supplied for XuPeng-SH re-review, not self-approved or waived. The measured b0 head's required CI was successful; the subsequent464 head's coverage failure is fixed via the upstream main merge and retained as historical FAIL. New exact-head CI and formal reviewer acceptance remain pending. Full TKE weekly integration remains later QA, not a prerequisite for code review.
V5 completed normally after the author relaxed only the task-specific disk floor to20GiB. Limits remained aggregate6GiB memory, swapmax0, CPU400%, GOMAXPROCS4,45-minute service deadline and exact-unit cleanup. No129 access or workload was performed. XuPeng-SH's outstanding performance review is not marked resolved by this evidence update.