Skip to content

fix(load): bound strict CSV boundary probes - #31387

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/1084d8736a67cb590ab6d3bc6cf359fa713308fe0ba69c01c569a3f552e0771e
Oct 27, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/1084d8736a67cb590ab6d3bc6cf359fa713308fe0ba69c01c569a3f552e0771e

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Oct 27, 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:

Strict parallel LOAD boundary planning could scan an entire illegal CSV tail and report each failed type conversion before execution returned the original row error.

Limit each strict probe to 256 KiB and 256 candidate records, then retain confirmed ranges and merge the remaining tail. Propagate cancellation through probing and range planning, with exactly one reader close. Add contextual parse entry points so speculative conversions suppress error reporting while ordinary callers keep their existing values, errors and reporting. The regular CSV reader keeps its existing buffer size.

Validation on darwin/arm64, Go 1.27.1:

  • Complete types, bytejson and external package tests pass; incremental vet and configured lint pass.
  • Deterministic tests cover byte/record limits, truncated boundaries, cancellation, close-error precedence, range coverage and all affected conversion families. Focused reporter-isolation race tests pass 100 repetitions each; the SQL observer/config case passes four race repetitions.
  • Embedded SQL crosses the parallel admission threshold with 601 rows: misaligned columns and invalid decimals retain serial error/rollback behavior; the valid control uses two ranges and preserves every row and value.
  • The same 100,000-row diagnostic now consumes 80 KiB with zero error reports, versus 2.3 MB and 200,000 reports before the fix. No large-file latency benchmark or new-head CI pass is claimed.

Very long records or illegal prefixes may reduce parallelism by exhausting the probe budget. Blocking storage Read/Close remains owned by the file service. The issue remains open for the reporter to verify after merge.

CI refresh validation (ee3f6c97761a44039497210d2b37d193876aa3ea, official base d4ffbae43d55da21526eab01722cbef14bb01ed5):

  • Mechanically rebased the two existing commits under the explicit CI-refresh instruction. Both patches remain equivalent in git range-diff; all 20 PR source/test files are byte-identical to published head 08b1fac9dc54a4120f470ac4a6d88a2d469a1689. No functional change was added to this PR.
  • Official main now includes test(hnsw): shorten the cross-CN freshness sweep in vector_hnsw_delete_insert (#31456) #31457, which shortens the HNSW test's cross-CN freshness sweep and restores its default afterward. This addresses the serving-wait/old-neighbor signature in run 40485563531, PESSIMISTIC job 122130701973 (rows 59/91 wait timed out; row 66 expected 2001, got 777). Coverage merge and CI Required failed downstream; no coverage verdict was calculated. Regular UT, UT Coverage, SCA and PROXY BVT passed on the preceding head.
  • Fresh validation on this head (darwin/arm64, Go 1.27.1): .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s -run '^TestLoadCSVStrictProbeFallback$' ./pkg/tests/sqlintegration — PASS (7.637s), all three 601-row scenarios: serial error/rollback parity, invalid-tail fallback and complete valid two-range loading. Test services and leases closed cleanly.
  • Prior owning-package, bounded-probe/cancellation, quiet-reporting, race and static evidence is reused for unchanged closures. The fresh SQL consumer check covers the upstream LOAD binder/parser changes. Diff/artifact checks pass; independent delta review passes. No broad suite was repeated solely for a SHA change.
  • This rebase triggers fresh CI instead of rerunning the old workflow. New-head Linux CI and distributed BVT remain pending; no new-head CI pass is claimed.

Quiet speculative type conversions retain normal parser configuration/resource-limit diagnostics; blocked storage Read/Close remains file-service-owned.

@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 Oct 27, 2026
@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Oct 27, 2026
@iamlinjunhong
iamlinjunhong force-pushed the codex/loom/develop/1084d8736a67cb590ab6d3bc6cf359fa713308fe0ba69c01c569a3f552e0771e branch from 6bd1ef0 to 30d2e74 Compare October 27, 2026 08:18
@XuPeng-SH

XuPeng-SH commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: ee3f6c97761a44039497210d2b37d193876aa3ea

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

Assessment: approve

Reviewed the complete delta and frozen discussion. Bounded probing, conservative fallback, cancellation, reader cleanup and scoped error reporting satisfy issue #31326. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Full types, bytejson and external package suites passed.

  • SQL regression passed twice on the same embedded cluster, covering error parity, rollback and lossless two-range loading.

  • Both focused reporting tests passed 100 race repetitions; the full types package also passed under race detection.

  • Preflight passed; retained native inputs and outputs were independently verified. Ten completed check receipts were matched to source fingerprints, exit status and logs in /home/xupeng/.local/state/mo-bot/jobs/4ae292fc1a937e1c590e3464/attempt-1/validation-audit.json.

  • Frozen CI reports successful UT, coverage, static analysis and active BVT configurations. Discussion assessment saved; source remains unchanged.

Limitations:

  • Benchmarks measured 3–106 ns additional cost for tested wide-decimal parses, with unchanged allocation counts; accepted as nonblocking. JSON parsing added 16 B/op.

  • No production-scale throughput or remote-storage timing claim is made. Interrupting blocked storage Read/Close remains the file service's responsibility.

@mergify mergify Bot added the queued label Oct 27, 2026
@mergify

mergify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as ee9b2d2 at 19:47 UTC

3 h 44 min in the queue, 56 min of it CI.

So far

  • ✅ Entered the queue Tue 27 Oct, 16:03 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Passed · in place
  • ✅ Merged 19:47 · ee9b2d2 · squash
Merge conditions: 3 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
✅ any of: check-success = CI Required, check-neutral = CI Required, check-skipped = CI Required GitHub branch protection

Times in UTC · dashboard · how the merge queue works

@mergify
mergify Bot merged commit ee9b2d2 into matrixorigin:main Oct 27, 2026
29 of 30 checks passed
@mergify mergify Bot removed the queued label Oct 27, 2026
XuPeng-SH pushed a commit that referenced this pull request Oct 28, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

- #31326

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

Follow-up to merged #31387, which bounded bad-CSV planning probes,
suppressed speculative conversion reports and added cancellation. Its
256 KiB cap can also merge a valid long-record file into one effective
reader.

Keep 256 KiB as a soft stopping threshold and derive a checked hard
budget from the execution parser's record-size limit and CSV tokens. An
initial fragment and the next candidate can complete. Suffix probing and
optional verification share that byte allowance and at most 256 parser
calls.

When physical probing reaches the former cap, verify each proposed
boundary exactly from FileStartOff, including subsequent boundaries.
Reject unsafe multiline and BOM restart boundaries, retaining earlier
ranges and merging the tail. Each acquired stream closes before another
opens, with cancellation and close-error precedence preserved.

Validation at `3db81d9d8d19dbf7a93208ca4959fb6f93661f55` (Go 1.27.1,
darwin/arm64):

- Reproduced the equality regression before the repair: a 6143-byte BOM
field becomes 6140 bytes, and valid multiline CSV errors with 20301.
Verification now also starts when physical suffix input equals 256 KiB.
- Rerun at `192158edb79f3b8e6c1364303b4d2b7ab83b1490` after the first
rebase; reused after the final Python-only main update (Go, native and
test inputs unchanged): the complete external package and ten
strict-load SQL scenarios with `-vet=all`, including seven threshold
unit variants and three public equality scenarios. Exact serial/parallel
values, retained fanout and safe fallback are asserted.
- Configured incremental golangci-lint reports zero issues. Reused
pinned molint analysis (built with Go 1.27) exits 0 with an existing
unsafe-import diagnostic in untouched `reader_arrow_test.go`; that file
and the diagnostic's inputs match the frozen base. Independent
design/final review is reused for the identical complete PR patch; the
delivery artifact checks pass.
- [Earlier Linux/x64
CI](https://github.com/matrixorigin/matrixone/actions/runs/40643822237)
is green and is reused for unchanged paths. New-head Linux CI is
pending. No new race or throughput campaign was run for this sequential
threshold correction.

The authoritative `CSVConfigForLoad` mapping and main's parallel-worker
isolation remain integrated. The prior short-probe allocation diagnostic
was about 88 KiB, confirming the hard cap is not preallocated. The
earlier unrelated UT cleanup timeout is tracked in #31545.

CI refresh: the two PR commits were replayed onto official main
`8f9bcd29ed8c236ec55c13bb9b88267a3a2a79ea`. All five PR files and the
complete PR patch remain identical. [Run
40672111550](https://github.com/matrixorigin/matrixone/actions/runs/40672111550/job/122761716321)
failed when the single planner race process reached its cumulative
40-minute package timeout; the active case had just started, and no race
report or compilation failure was logged. Main now includes #31593's
bounded planner scheduling change. This authorized rebase triggers new
CI with that change; it does not establish that the timeout is fixed.
The superseded run is not rerun.

Verification may reread a prefix. Its shared hard cap is about 384 MiB
per attempt with the default record limit; distant targets or prefixes
with many short records can still reduce fanout. No throughput
improvement percentage is claimed. The issue remains open for reporter
verification after merge.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
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 size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants