Skip to content

fix(load): close ETL readers after prescans - #30407

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/381888bef2060cacb9b4c5c616388bd09838f82262c8cd099f52d60c4f409639
Oct 16, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/381888bef2060cacb9b4c5c616388bd09838f82262c8cd099f52d60c4f409639

Conversation

@iamlinjunhong

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

LOAD DATA ignored-line prescans leaked the reader returned by the ETL file service. Repeated loads could retain open files or remote streams.

Close the original reader on every return after successful acquisition, including normal scans, EOF, parser initialization errors, read errors and cancellation. Preserve offsets, scan errors and the existing read-only cleanup convention for Close errors.

Keep regression coverage for parallel tail-probe readers as well. Current official main already closes those readers; this PR preserves its line-terminator handling, error propagation and file-end split behavior without adding another Close. The prescan test fixtures follow main's SQL file-access policy. Also bind that policy in the existing direct Arrow/MinIO reader fixture, which bypasses Prepare, preserving its object-replacement and allocation-cleanup assertions.

The two close-tracking tests use real local ETL file services and cover 17 scenarios, including partial reads, multiple probes, no-probe operation and failed later acquisition. They check offsets/errors, exactly-once cleanup and closing each probe before opening the next.

Rebased onto official main 4e325495984c5f8a8dbf15500caa086d9e9159d1.

Validation on macOS arm64, Go 1.27.1:

  • Focused prescan regressions and existing split-boundary, probe-ownership and strict enum/set tests passed through mo-cgo-test.
  • The real local MinIO object-replacement regression passed after binding the direct reader fixture's authorization context.
  • Complete pkg/sql/plan and pkg/sql/colexec/external package tests passed through mo-cgo-test -count=1 -timeout=300s.
  • Incremental go vet, gofmt and golangci-lint for both packages passed.

No SQL results, API or file formats change. External remote-storage services remain unverified locally; the local MinIO regression passed and new-head CI is pending. Reporter verification remains needed after merge, and the issue should stay open until that verification.

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

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 874da53264c00aff1f208baf22fd84b8b26b55c8

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: 874da53264c00aff1f208baf22fd84b8b26b55c8

Assessment: approve

Reviewed the complete four-file delta and affected owners/callers. The acquisition-site defer correctly closes the prescan reader across success and failure paths without changing offsets or errors. Cleanup remains with the existing owner; no additional state or abstraction is needed. The tests provide meaningful ownership and error coverage. No actionable defects remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Both owning packages passed on Linux amd64, Go 1.27.1, with -count=1, -vet=all and the supplied isolated test executor. All 17 new prescan scenarios passed.

  • Base-code control reproduced six zero-Close failures; the failed-acquisition control passed. The candidate passed those same scenarios.

  • Isolation preflight, gofmt, diff checks and clean-source verification passed. Native prerequisites were built through the repository Makefile; 198 input hashes and 56 artifact hashes were verified.

  • Commands, frozen-source fingerprints, terminal receipts and retained logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/cbed481d9ae4075302727396/attempt-1/validation-index.json. Complete review reasoning is retained in review-map.json.

Limitations:

  • The MinIO integration test skipped locally because its binary was unavailable; both download attempts returned HTTP 410. The author reports a passing run, but no retained transcript was supplied. The fixture-only context change matches production Prepare by inspection.

  • Remote-storage reporter verification remains outstanding. The separate #30394 issue body was absent; its contract was assessed from the supplied PR description.

  • No throughput benchmark or race stress was run: the change adds one necessary synchronous close per eligible prescan, with no new shared state or work on unrelated SQL paths. Two unrelated planner cases also skipped.

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

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-16 21:44 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-16 23:25 UTC · at 96605dcd63a0775e7d4208775ba782c6b0960745

This pull request spent 1 hour 41 minutes 5 seconds in the queue, with no time running CI.

Reason

Pull request #30407 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Copy link
Copy Markdown
Contributor

补齐此前缺失的 MinIO 验证(2026-10-17):main a322466757b9b0165c59fbda565608653d923b2a,Linux/amd64、Go 1.27.1、匹配 CGo。使用官方 MinIO 源码 tag RELEASE.2025-04-22T22-12-26Z / commit 0d7408fc9969caf07de6a8c3a84f9fbb10a6739e 构建本地临时依赖。

  • TestExternalArrowLoadFromLocalMinIOAndRejectsObjectChange:普通与 race 均实际执行通过,覆盖绑定授权后的真实 S3-compatible FileService 对象替换检测及 allocation cleanup;不再是 skipped。
  • TestArrowLoadBVT/LocalMinIO:两 CN 的 6 个公开 SQL 子场景全部通过:DirectFileAndObjectRefresh、DirectStream、S3BackedStage、MultiObjectSuccessAndCorruptRollback、ObjectChangeFailsClosed、CanceledRequestReleasesS3Read。
  • FS 配置补充对照:用隔离本地 MinIO 配置运行已有 TestNewS3FSFromSpec 的好 bucket / 坏 bucket 断言,均通过;这是本地 S3-compatible 对照,不代表真实云厂商凭据覆盖。

完整 external 包普通/race 的 prescan/close 断言也已通过。#30394 已转 @Ariznawlll,保持现有转测状态。

This branch was previously deployed

1 inactive deployment
ci — 96605dcd Deployed Oct 17, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants