Skip to content

Support query-level IVF nprobe on 4.2 - #31754

Merged
XuPeng-SH merged 8 commits into
matrixorigin:4.2-devfrom
iamlinjunhong:issue-30414-4.2
Nov 2, 2026
Merged

XuPeng-SH merged 8 commits into
matrixorigin:4.2-devfrom
iamlinjunhong:issue-30414-4.2

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

Support query-level nprobe for IVF rank options, with query override taking precedence over the session setting and existing fallback. Propagate the value through planning to IVFFLAT and IVFPQ, and document tuning, approximate search and GPU prerequisites. Invalid or unknown rank options now return errors instead of being ignored.

The existing 4.2 AUTO behavior falls back to PRE on an empty result; a nonempty short page does not trigger fallback. Approximate search can therefore still return fewer rows or miss neighbors.

Validation: native libraries and service built on macOS arm64 CPU; parser, planner and protobuf package tests, vet and incremental lint passed. The rank-options SQL case passed twice (63/63 each), and the vector directory passed with 1836 successful statements and two existing ignored statements. The tester did not compare JDBC metadata. CI remains pending. GPU search was not run, and the original high-dimensional data and queries were unavailable; these results do not establish recall for that dataset or arbitrary data.

Performance: option parsing and parameter selection add bounded per-query work; increasing nprobe can increase search cost. Default probe behavior is preserved.

Related main PR: #31753

CI repair: selectively backport the fileservice HTTP-trace lifetime fix from #30472 while preserving the 4.2 interfaces. Each actual HTTP request owns its trace, and concurrent callbacks synchronize timing state. This removes the pooled-trace reset race observed in the file TVF/Hive SQL test, including lazy List and multipart requests.

Repair validation on Linux/amd64, Go 1.26.4: complete fileservice normal and race tests passed; four directly affected concurrency tests each passed 100 race repetitions; the exact TestSQLFileAccessTenantStageCDC/file_TVF_and_Hive_planning_admission regression and its parent cleanup passed under race. Scoped vet and golangci-lint passed. The in-memory RoundTrip benchmark measured 1.33 us / 368 B / 2 allocations unmarked and 3.44 us / 1,344 B / 22 allocations traced. Fresh GitHub CI remains pending.

The subsequent UT failures were in initial statistics-test connection setup (HAKeeper ID-allocation timeout before any statistics SQL) and stale-index fixture cleanup. Both exact tests pass three race repetitions (-count=3, not separate processes) at head 1038d07054 and at clean 4.2-dev baseline 260678bace0; their fixtures and native inputs match. This is bounded attribution evidence, not proof that HAKeeper availability is fixed.

The stale-index fixture now reports a failed DROP on the owning test and checks catalog absence after successful cleanup, instead of silently leaving a database for the next subcase. It retains the existing timeout and semantic assertions. All four standalone DROP INDEX cells and both stale-generation sibling tests pass under race with the new cleanup checks; scoped vet/lint and independent Astra medium review pass. No statistics timeout or reconnect workaround was added. New-head hosted CI remains pending.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

mergify Bot pushed a commit that referenced this pull request Oct 29, 2026
Extend IVF rank option regression coverage for query-level nprobe overrides and session isolation. Two connections exercise distinct session values, a query override, and recovery after invalid options; a small fixture compares POST and FORCE results.

Validation: native libraries and service built on macOS arm64 CPU. The rank-options SQL case passed twice (63/63 each) with the official tester; the vector directory passed with 3362 successful statements and two existing ignored statements. The tester did not compare JDBC metadata. CI remains pending. GPU search was not run, and the original high-dimensional data and queries were unavailable; these results do not guarantee recall on arbitrary data.

Performance: test-only changes; no production runtime impact.

Related 4.2-dev PR: #31754

Approved by: @XuPeng-SH
@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: ebab89c15e2e17e503b7a837385a863f1a7902fc

Review completed. Read the assessment.

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

mo-bot review · mo-bot-local · review

Commit: ebab89c15e2e17e503b7a837385a863f1a7902fc

Assessment: approve

Complete review found no actionable defects. Query-level nprobe preserves existing runtime semantics; request-owned HTTP traces handle concurrent and late callbacks safely.

Model: gpt-6-astra / xhigh

Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2

Validation:

  • All tests passed in pkg/pb/plan, pkg/sql/parsers/dialect/mysql, pkg/sql/plan and pkg/fileservice (packages.log).

  • Full fileservice race suite passed; four trace/multipart tests passed ten race repetitions (fileservice-package-race.log, trace-race.log).

  • Focused tests and generated parser/protobuf audits passed. Frozen CI reports successful UT, SCA and proxy/pessimistic BVT.

  • Source remained clean; all three discussion keys accounted for. Commands, source fingerprints, exits and log hashes reconciled in validation-evidence.json.

Limitations:

  • GPU execution and the original high-dimensional recall dataset were not tested locally.

  • SQL/JDBC and embedded-cluster cleanup runs were not repeated locally; supplied CI and author reports supplement source review.

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

Reviewed the 4.2 backport at ebab89c. The query override is validated before planning, survives copy/serialization, takes precedence over the session only for this query, and remains a base rather than an AUTO hard ceiling. Checked both IVF consumers, parser rejection cases, SQL session isolation/restoration and the generated semantic changes. The trace repair gives each actual request a non-pooled callback lifetime, synchronizes timing state, preserves caller hooks, and handles lazy listing/multipart requests. No blocking issue found. Reused the reported focused/package/race/BVT evidence and green exact-head CI. No new local tests or GPU execution; no original-dataset recall claim.

@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: ebab89c15e2e17e503b7a837385a863f1a7902fc

New discussion was assessed; the previous review remains unchanged.

This branch was successfully deployed

No deployments
ci — 3d3c3ee1 Deployed Nov 2, 2026 by XuPeng-SH
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/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants