Skip to content

[4.2.1-hotfix] backport ETL marker and multi-CN IVF fixes - #32035

Merged
XuPeng-SH merged 2 commits into
release/v4.2.1-hotfix-20261026from
codex/backport-421-etl-ivf
Nov 2, 2026
Merged

XuPeng-SH merged 2 commits into
release/v4.2.1-hotfix-20261026from
codex/backport-421-etl-ivf

Conversation

@XuPeng-SH

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:

Related to #27740 and #28943.

What this PR does / why we need it:

Backport two existing fixes to release/v4.2.1-hotfix-20261026, in their original order:

Both cherry-picks apply without conflicts and retain identical patch IDs. Only the original four files change.

Validation on this release base: full export, compile, Top and MergeTop package tests in normal and race modes; IVF planner direction/pagination/INCLUDE controls; incremental lint, vet and formatting. Existing multi-CN IVF BVT: 26/26 statements pass twice on one local two-CN cluster, with schema cleanup checked after each run.

IVF global ranking consumes all emitted partition candidates and adds sorting work. The source PR reported about 27% higher median latency on one historical million-row fixture; that benchmark was not rerun here. The local BVT is a topology smoke test; deterministic competing-stream ordering is covered by generated-operator tests. CI is pending.

LeftHandCold and others added 2 commits November 2, 2026 22:49
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue #27740

## What this PR does / why we need it:

Cherry-picks the focused fix from #27748 onto `v4.2.1-hotfix`.

S3-compatible object stores can expose zero-byte folder marker objects
while ETL merge scans a log directory. The merge task previously treated
every listed entry as a data file, allowing an unsupported marker path
to reach `newETLReader` and panic the CN.

This backport:

- skips directory and unsupported entries before adding them to an ETL
merge batch;
- dispatches readers by the exact final `.csv` or `.tae` extension;
- returns `ErrNotSupported` instead of panicking if an unsupported path
reaches `newETLReader`;
- includes the deterministic regression coverage from #27748.

Backport scope:

- target base: `v4.2.1-hotfix` at
`d2393868a7aaa6343518d80849fe4696aa3577e9`;
- source commit: `3b265f1ddcc62cacafa0ab695feeb2e35ab6711f`;
- stable patch-id matches the source commit;
- only `pkg/util/export/merge.go` and `pkg/util/export/merge_test.go`
change; the unrelated FULLTEXT2 commit from `4.2-dev` is not included.

Validation:

- focused CGo-controlled selection and execution passed for
`TestMergeMainSkipsNonETLEntries`, `TestIsETLFile`, and
`Test_newETLReader`;
- full CGo-controlled `./pkg/util/export` package test passed;
- `git diff --check` passed;
- source PR #27748 completed its required CI successfully.

BVT is not applicable because this changes only the internal ETL
background file-selection contract and has no SQL-visible behavior.

Co-authored-by: aptend <[email protected]>
(cherry picked from commit 9bf92dc)
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Fixes #28943

## What this PR does / why we need it:

Partitioned IVF search applied an unordered global candidate LIMIT, so
the first CN could consume the entire budget before better candidates
from another CN arrived. Identical POST queries could replace an entire
200-row branch of a UNION ALL result.

At the existing multi-CN compiler boundary, use the existing local Top /
MergeTop operators on the raw distance column before projection and the
original global LIMIT. Preserve the candidate budget, partition
dispatch, bucket selection, and all single-CN fallback paths. The change
is limited to 17 production lines in the compiler; it does not alter the
planner, index format, or configuration.

### Validation

- Regression tests compile the actual candidate pipeline and execute its
Top/MergeTop operators against an independent global-sort oracle. Cover
1/2/3 CNs, absent/zero/one/bounded caps, empty/short/exact-size inputs,
reversed arrival order, later better batches, INCLUDE NULL payload, and
Reset reuse with memory cleanup.
- The same regression tests fail against the exact unfixed base using a
Go source overlay; fixed tests pass.
- Build and vet; compile package normal and race suites; each new test
repeated 100 times under race; dependent Top/MergeTop suites; planner
direction/pagination/INCLUDE controls pass.
- Million-row fixture: `vecf32(1024)`, `lists=1024`, `probe_limit=5`,
two CNs, large text columns, two POST LIMIT200 branches. All 30
executions return the same 400-row multiset and match the independently
established selected-bucket result oracle. Physical plan retains two CNs
and has ordered candidate merging before the join.
- Public SQL controls cover POST pagination/zero/empty, INCLUDE covered
and row-fetch paths, residual filters, and repeated prepared execution.
Cancelling an active POST query returns `context canceled`, followed by
a successful 400-row POST query.
- An additional rare-filter INCLUDE expansion case returns empty on both
the fixed binary and the clean base binary built in a detached worktree,
using the same index/query. This existing boundary behavior is
documented rather than changed by this hotfix.

### Cost and scope

Global ranking must consume candidates from every partition instead of
stopping on the first partition. It adds bounded candidate-selection
work, while keeping the join input capped and leaving single-CN
execution unchanged. In six warm runs per version on the same fixture
and cluster, median latency was 8.26 s on the incorrect baseline and
10.51 s with the fix (about 27% higher). This is a small sequential
sample, not a statistically controlled benchmark or a claim of zero
overhead. Both versions used two excluded warmups; no concurrent
builds/tests ran during these measurements.

Based on `v4.2.1-hotfix` at `9bf92dc56bc2d3956500425e95f502642e09ae9d`.
The million-row test reuses the existing index built on 4.0-dev. No
changes to NaN handling, equal-score tie-breaking, index training, or
main's newer IVF architecture are included.

(cherry picked from commit 115c227)
@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 mergify Bot added the kind/bug Something isn't working label Nov 2, 2026
@mergify

mergify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: b3a57aafd6d691c501b7532ab2a196dc46830567

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

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

Assessment: approve

The ETL filtering and global IVF candidate-ranking backports preserve existing ownership and compatibility contracts. No actionable regression found.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • Reviewed the complete delta, affected consumers, linked issues and all discussion entries.

  • Five focused regressions passed normally and under race instrumentation, including 100 race repetitions each.

  • Five IVF planner controls passed.

  • Export, Top and MergeTop packages passed normal and race runs.

  • Vet, formatting, source integrity and discussion coverage checks passed.

  • Matched 16 check receipts to retained logs in /home/xupeng/.local/state/mo-bot/jobs/7b798895ede3f6f11ca354a3/attempt-1/validation-evidence.json.

Limitations:

  • Compile package runs failed three Parquet fanout tests; the identical failures reproduced on a verified frozen-base overlay.

  • No fresh multi-CN SQL or performance run; author-reported results were not counted as independently verified passes. Relevant frozen CI remained incomplete.

  • The original IVF commit was unavailable for patch-ID verification; its complete candidate delta was reviewed directly.

@XuPeng-SH
XuPeng-SH merged commit 87866e6 into release/v4.2.1-hotfix-20261026 Nov 2, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/backport-421-etl-ivf branch November 2, 2026 15:50
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants