Repository navigation
fix(import): bound memory and pipeline uploads on 4.2-dev - #32065
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? |
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed exact head dfb9dd56be9573708add61fee2f89fd1b45931df against 4.2-dev base 10d204b8763f19b2b37ba2147d1d4c1a7828d6d4.
No confirmed actionable findings within this PR's scope. Reviewed admission/accounting, CSV framing and growth, upload ownership, metadata streaming, cancellation/reuse, fallback eligibility, and planner compatibility.
The supplied CI snapshot contains 29 completed checks: 14 success, 13 skipped, and 2 neutral. They are not all success; none is failed or pending. CI Required passed.
Local read-only validation: git diff --check and the Loom PR artifact check passed. No local Go tests or service runs were performed: the code review did not identify a remaining hypothesis requiring targeted execution; existing exact-head CI results were used as reported evidence. The PR explicitly leaves the TKE performance comparison unverified.
This is the first review; there are no previous review findings or author responses to reconcile.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: dfb9dd56be9573708add61fee2f89fd1b45931df
Assessment: request_changes
A legacy transaction admission self-wait remains. This concrete path changes the approval conclusion in review 5748882523.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
- P1
pkg/sql/colexec/multi_update/s3writer_delegate.go:523: In BEGIN or autocommit=0, an unadmitted S3 writer exhausts both immediate allocation attempts while its input or prior transaction workspace retains the needed headroom; the request remains below MaxAcquire.
Impact: AcquireContext waits while the statement retains those resources, preventing the session from completing and committing until cancellation. Apply the transaction no-wait policy here and return a capacity error instead of enqueueing.
Evidence: multi_update.go:201 and s3writer_delegate.go:582 retain input across acquisition. admission.go:322 waits for capacity or cancellation; recovery cannot reclaim live transaction data. disttae/txn.go:882 preserves prior-statement workspace. import_memory.go:64 explicitly avoids this self-wait for controlled admission, but fallback lacks that guard. The pressure test supplies external capacity through beforeWait, so it does not cover this cycle.
Validation:
-
Mapped 155 changed paths and reconciled all four discussion entries.
-
Static audit passed with matching retained logs: checks/1793693766491237931-2.json.
-
Considered exact-head CI: 14 successful, 13 skipped and two neutral checks, plus author-reported validation.
Limitations:
-
The finding is source-established; no product runtime reproduction was executed. Native prerequisites and raw author runtime logs were unavailable.
-
Dependent deep validation stopped at the admission blocker. TKE performance comparison remains unperformed.
|
Rebased onto Resolved the ParallelRun conflict by keeping upstream reader-build cancellation normalization/reporting before the existing panic-safe cleanup. Kept upstream #32439's reset-output test and removed the redundant local test patch. All new runtime-filter/IVF and other target fixes are retained. Fresh integration checks pass 1,282 top-level tests / 2,408 named cases in both normal and race modes across compile, HashBuild, runtimefilter, table_function, ioutil and mpool. Four exact ParallelRun/reader cancellation, primary-error and deadline controls each pass 100 race repetitions. Main-pinned incremental SCA selects ./... and passes, plus err-check, license header/dependency checks and native command build. No new TKE/throughput claim. Body evidence is updated; new-head CI/re-review remains pending. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed 0cfe8ae00165fe3c7174d5a0a9b961fc921355ad against 4.2-dev@bf15b1c7a82e1801fb0a34f234b77d92d6766606. Request changes: the allocator fast path and the IVF INSERT IGNORE public regression address the later review feedback, and the recovery-worker and original temporary-spool findings have targeted changes. Two earlier metadata-progress findings remain reproducible on this head and prevent treating the change as a complete solution.
- Raw uncommitted-delete keys accumulate until EOF. With the real writer and coordinator, 128 windows each containing a distinct uncommitted RowID and 4-KiB key under a 256-KiB D budget complete only five windows, then fail with
needs 99328 bytes, available 77728. Each individual window fits. The retained payload is real row/key data, not bounded object statistics. Please preserve bounded incremental progress using an appropriate existing storage/streaming owner, and cover aggregate output larger than the budget, delete-before-insert, deduplication and cleanup. - Retaining any metadata rejects an independently releasable wait. Under known autocommit, the real coordinator test holds 1,240 bytes for this writer, a separate owner temporarily occupies the rest of a 1-MiB budget, and an 8,192-byte request fails instead of waiting. Releasing the independent owner leaves 1,047,336 bytes available. Please distinguish an actual self-dependency from other owners' releasable pressure and preserve cancellable waiting when progress is possible.
I reviewed the author's explicit decision to retain these limits and the earlier approval of the in-memory/no-wait design. That explains the present behavior, but it does not eliminate the demonstrated statement failures for valid input or unrelated transient pressure. The 39-table import evidence measures compact insert metadata and does not cover cumulative raw-delete keys.
Validation: reran both existing review counterexamples on this exact head using a test-only Go overlay and the real coordinator/writer paths; both reproduce the same failures. These are reduced-budget component tests, not production workload or OOM claims. Reconciled the 151 unchanged PR files against the earlier reviewed head and inspected the eight changed paths, including the same-owner MPool.Free fast path and the new persisted IVF/search oracle. CI failures were not considered.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 0cfe8ae00165fe3c7174d5a0a9b961fc921355ad
Assessment: approve
The port reuses existing allocation, HashBuild, SinkPool and pipeline owners, avoiding an additional metadata-storage lifecycle. The disputed metadata rejections demonstrate explicitly accepted capacity and no-wait limits; no overriding mandatory contract was established. Allocator and persisted IVF regression feedback is addressed.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Mapped all 159 paths, verified 151 source-identical inputs against prior reviewed coverage, and inspected the complete eight-path follow-up and affected consumers.
-
Reconciled all 49 discussion entries and both linked issues, including the metadata-policy dispute.
-
Static audit passed: frozen source identity, whitespace, gofmt/syntax for 151 Go files, plugin guard and discussion coverage. Evidence: source-audit.log; checks/1794283508641778924-4.json, exit 0.
-
Reused frozen-head CI: 14 successful, 13 skipped and two neutral checks. Assessed attributed normal/race/stress, SQL and workload evidence by tested revision.
Limitations:
-
No new local product, race, SQL or workload execution; raw author/CI reports were unavailable.
-
Cumulative raw-delete metadata can exhaust its budget, and retained output conservatively prevents waiting despite possible independent release. These are documented accepted limits.
-
Historical performance results do not establish current-head throughput; increased upload calls remain an acknowledged tradeoff.
|
Addressed this review together with the same feature in #32241, at The two metadata P2 counterexamples are fixed: raw delete keys stream per frame rather than accumulating until EOF; retained output alone no longer forbids waiting for an independent owner. Compact admitted metadata retains the memory fast path and switches storage only on capacity denial. The existing explicit-transaction self-wait guard remains. Both branches now use the same metadata-progress and source-buffer ownership contracts. Legacy replay charges only its live decoded frame. Real one-object-budget barriers verify that another object cannot start fetching while the first buffer is still being written, and that cancellation cannot refund a live chunk/write. A size-growth denial releases the entire old attempt before re-admission. Shared regression cases cover both releases; the native hash/spill and job implementations remain release-specific. Normal/race owning suites pass (967 top-level / 1263 named cases), affected lifecycle tests pass 100 separate exact-name race repetitions, pinned latest-main SCA passes, and err-check/licenses/native build pass. Old-behavior production overlays compile and fail the new runtime oracles. The body/design now describe the current policy and retain historical workload identities. New-head CI is pending; re-review is requested through the review-request API. |
|
Fixed both new waiting-lifecycle findings in both release branches; head
Validation: 876 owning top-level tests / 1062 named cases pass normally and with race; partition retirement, independent frame waiting and TTL waiting each pass 100 separate exact-name race repetitions. Both old-behavior overlays compile and fail the new oracles. Fresh native two-partition SQL smoke passes 20 statements per release, including mixed committed/uncommitted deletion, rollback and commit; reduced-budget hang proof is component-level. Pinned latest-main SCA ( |
|
CI correction pushed at The ten CCPR integration failures had a concrete common cause: publication object fetching requires CN memory admission, but the owner was bound only by ExecuteIteration, while direct ApplyObjects calls bypassed it and the engine test runtime never registered the coordinator. ApplyObjects now resolves the existing coordinator through Engine.GetService and keeps explicitly supplied owners. The test runtime installs the real coordinator; absent admission still fails before allocation. No admission bypass or new setting was added. Validation: the original TestApplyObjects failure was reproduced on each previous head. All ten formerly failing engine tests now pass in normal, race and atomic-coverage modes on both variants. Publication package normal/race passes; the new runtime-owner / explicit-owner / missing-owner controls pass 100 exact-name race repetitions. Local pinned SCA against latest upstream main (including tests/reverse dependencies), err-check, license checks and native service builds pass. Both PRs keep five commits and their respective release baselines. Fresh GitHub CI is pending. |
|
Rebased the five commits onto latest Resolved the arena_pool.go/writer.go conflicts by keeping upstream #32454's serial-buffer retention cap and metric together with our complete-byte/shared-pool budget. Trimming happens before reservation, gauge addition before lock-free publication, and both accounting paths are retired on checkout/drain; rejected puts do not add gauge. Seven extra lines strengthen existing small pool tests, with no new fixture or setting. Objectio/ioutil/metric owning tests pass in normal/race, focused concurrent accounting controls pass repeated race runs, and the real two-Merge retention consumer passes under race. Pinned local SCA against latest main and native build pass. Unchanged import/CCPR evidence keeps its original source identity; fresh GitHub CI is pending. #32241 has no conflict and was left unchanged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: b9c03d7a445a74c4eadb76924555432eab1d4642
Assessment: request_changes
The port coherently reuses 4.2 admission, allocation and pipeline owners. Restored metadata files reintroduce a cumulative-storage admission gap.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
- P2
pkg/sql/colexec/multi_update/s3writer_delegate.go:1873: A writer produces many individually valid metadata frames, exceeding the query spill allowance before EOF.
Impact: Both metadata files bypass cumulative query/CN spill admission and use OS-temp storage directly. They can exhaust the temporary volume; RAM-backed TMPDIR also retains output outside I/D/W. Use the existing spill file service and growing storage reservation for both writers, with pre-write rejection and cleanup coverage.
Evidence: writeMetadataBatch checks individual frames before metadataWritten += 9+n. INSERT similarly appends ObjectStats records until EOF (controlled_s3.go:517–548). Neither path uses Lim.SpillSize, ReserveSpillDisk/Grow or GetSpillFileService. Existing bounded ownership is wired in compile.go:637–669 and internal/materialized/source.go:318–350. Restoring these files reopens discussion 4484857726; streaming and eventual Close do not bound cumulative storage.
Validation:
-
Mapped 169 changed paths, reconciled all 55 discussion entries, verified 145 source-identical files against prior coverage, and assessed the 24 changed/new paths and affected owners.
-
Isolation preflight passed: checks/1794303349234496200-4.json; preflight.log.
-
Source identity, whitespace, gofmt/syntax for 161 Go files, index-dispatch discovery and discussion-ledger audit passed: checks/1794304536885195067-4.json; source-audit.log and validation-ledger.json.
Limitations:
-
The finding is source-established; no local Go, race, SQL, disk-exhaustion or OOM reproduction was run. Dependent runtime validation stopped at this resource-ownership blocker.
-
Current-head CI results and raw author execution logs are absent. Reported tests and historical workloads retain their actual revision and measurement limits.
|
Updated to The repeated review findings exposed ownership/termination boundaries missed when introducing preflush and the protection observer. The fix now covers their full local transitions:
Final validation: owning Scope versus release base: 91 production Go files, +10994/−775; this correction touches 9 (+423/−58). Shared DML/publication paths are affected; this is not LOAD-only. The 4.2 total also includes the original combined import-memory port. No planner/allocator hot-path/merge-policy change is added here. Five commits are retained per branch. The body/design describe the final behavior and retain historical workload measurements with their original revisions. These SQL/component checks do not claim final-head full-workload throughput or an end-to-end low-memory SQL reproduction. New CI and reviewer decisions are pending; API re-review requests follow this update. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 6adfea171977901fecbf085314b0f403418653c2
Assessment: request_changes
The port reuses 4.2's existing owners, but the new delete-key deduplication file bypasses native spill budgets. The metadata-spool correction leaves this resource owner uncovered.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
- P2
pkg/sql/colexec/multi_update/delete_key_set.go:47: A WriteS3 UPDATE/DELETE processes RowIDs from the transaction's uncommitted workspace.
Impact: Each table/partition retains an uncounted TMPDIR file and FD until Reset/Free, with a 512 KiB bucket table plus 32 bytes per distinct RowID. These costs bypass LOCAL placement and query/CN spill limits. Reuse MetadataSpool/native reservations, admitting bucket storage and record growth before writing and refunding on close.
Evidence: s3writer_delegate.go:1004-1010 creates this owner for uncommitted rows. delete_key_set.go:47-60 and :82-96 create and extend it without disk or FD admission. MetadataSpool at metadata_spool.go:33-66 already provides LOCAL and native budget ownership. The new quota test covers metadata frames; dedup tests omit spill-budget checks.
Validation:
-
Source audit passed: 176 frozen paths, whitespace, formatting of 168 Go files and all 58 discussion keys (source-audit.log; checks/1794313316958982086-2.json).
-
Isolation preflight passed (preflight.log; checks/1794312081665239352-2.json).
-
Frozen CI reports 14 successful, 13 skipped and two neutral checks. Author-reported validation was considered within its stated scope.
Limitations:
-
The finding is source-established; no runtime exhaustion reproduction or local Go/race/SQL tests were executed.
-
Remaining detailed regression-test and runtime validation was deferred at the design blocker. Historical performance results do not establish final-head throughput.
|
This pull request is merged. |
|
Addressed the delete-key spool ownership finding from review 5841730725 in The earlier correction covered INSERT/MultiUpdate output spools but missed the transaction-local dedup file. This follow-up reuses The pre-fix real Validation: focused regressions pass; full Incremental scope: two production files +11/-6, one existing test file +61/-4, maintained design +5/-2. The already merged 4.1 PR is unchanged; 4.1 has no equivalent native spill-budget API. API re-review requests follow this update; new CI is pending. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 9a2948051e43ea3ad5d49e5651dfa9e62a5f01ec
Assessment: approve
The remaining dedup spill gap is fixed through the existing native disk/FD owner. Bounded streaming supersedes the earlier metadata-policy dispute; allocation, upload and pipeline ownership remains coherent.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Assessed 176 paths using 172 source-identical prior paths plus the four-file update and affected owners; reconciled all 62 discussion entries and linked issues.
-
Source, formatting and evidence audit passed for 168 Go files. Receipt: checks/1794329730217226466-2.json; log: source-audit-04.log.
-
Frozen-head CI reports 14 successful, 13 skipped and two neutral checks. Author reports 150 multi_update cases per normal/race mode and 20 public SQL checks on the final build.
Limitations:
-
No new local product Go/race/SQL execution; raw author and CI runtime logs were not supplied.
-
Historical workloads use older revisions; no final-head throughput, SQL quota-exhaustion or OOM reproduction is claimed.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 18efc7994278a7ca02ad8345e9d4933448bd85de
Assessment: approve
No actionable findings remain. Existing admission, allocation and native spill owners coherently bound distinct buffer, upload and metadata lifetimes. Earlier self-wait, block-layout, worker-retirement and spill-budget concerns are resolved; bounded streaming supersedes the metadata-policy dispute.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Mapped all 176 paths: 175 are byte-identical to the source assessed by review 5845936087; compiler feature edits remain unchanged across upstream integration.
-
Fresh source, formatting, ownership and evidence audit passed: checks/1794385379776794227-2.json matches source-audit.log. Source remains unchanged.
-
Assessed all 64 discussion entries and both linked issues; retained discussion-assessment.json and review-validation.json.
-
Frozen CI reports 14 successful, 13 skipped and two neutral checks.
Limitations:
-
No fresh product Go, race, SQL, native or workload execution; matching prior-review and author reports were reused. Raw runtime logs and linked images were unavailable.
-
Historical workloads do not establish final-head throughput or a hard process-memory/OOM guarantee.
-
Skipped upgrade checks are not passes.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26992 and #32146. Port #31166 and #31810 together.
What this PR does / why we need it:
Port #31166 and #31810 together while preserving native 4.2 allocation-owned HashBuild, SpillEngine, PipelineEdge, scheduling and RETURNING behavior. Supported local CSV graphs reserve producer/data/upload memory; unsupported graphs retain whole-statement fallback. Head
9a2948051e43ea3ad5d49e5651dfa9e62a5f01ecis based on4.2-dev@c0532d1aa586b9be473eb82492d29e27861e095f, with five commits. Maintained design. Paired release PR: #32241.INSERT metadata, MultiUpdate metadata and transaction-local delete-key deduplication reuse existing statement/CN spill-disk and FD reservations. Dedup bucket storage is admitted before sizing the file, each distinct RowID before append; duplicates need no growth. Close/Reset/Free return the reservations. Regressions verify cumulative rejection before writing, shared-file quota reuse, partial creation and cancellation; removing admission fails both consumer oracles. The explicit-transaction nonblocking guard and upstream serialization-retention/grouping-key fixes remain.
Impact: 91 production Go files versus the release base; the latest dedup correction touches 2 production files (+11/-6), one existing test file and the maintained design. Shared writer/admission and publication paths include ordinary DML/publication; this is not a LOAD-only change. This correction adds no planner, allocator hot-path or merge-policy change.
Validation:
multi_updateowning package passes normal and race modes (150 named tests each). A pre-fix real delete-preparation test fails its storage-ownership oracle; fixed tests cover bucket/record quota denial before writing, duplicate lookups at capacity, shared metadata/dedup charges, Reset refund and reuse. Unchanged insert/colexec/publication/ioutil code retains source-valid normal/race evidence. Native binaries embed this final commit and pass 20 SQL statements each: two partitions, 36,000 committed rows plus same-transaction rows, exact counts/sums, DELETE, rollback/commit and teardown. Test services are stopped and generated data is removed. This is a functional control, not a SQL low-memory failure reproduction or a current-head throughput result.main@61b5a4ee202578d2b186559f49af94b7c12b85a9. Its incremental selector selects./..., including tests and reverse dependencies; Go 1.26.4, CGO and built thirdparties artifacts are used. Repository-pinned molint222a0b8adf07and golangci-lint v2.6.2 pass; lint reports zero issues:License/header checks and native builds pass. New GitHub CI and re-review are pending.
Historical workload evidence retains its original revisions/configurations:
10d204b876, versus candidate attempt 4,67179b6eed: identical workflow93631633b7, importer35e18afa1b, inputs/schema/index/order; two CNs, each 10 CPU/20 GiB, cache 2 GiB, GOMEMLIMIT 16000 MiB; TN 5 CPU/15 GiB. Both complete four rounds/156 row-count checks. Candidate completes 156 retry-free imports with zero OOM/restarts; baseline completes 150 retry-free imports with seven retries and six restarts/OOM in rounds 2–4. Highest observed single-CN cgroup usage: 18.904 → 2.872 GiB; sampled RSS: 18.247 → 2.663 GiB. Clean first-round importer calls: 379.434 → 368.488 s (-2.88%); four-round total including baseline recovery: 2358.215 → 1469.192 s (-37.70%). Calls include DDL/rename/validation. Clean-round S3 writes increase about 865 → 3293 while bytes decrease 8.211 → 7.933 GiB. Baseline artifacts / candidate artifacts.10d204b876, versus port,dfb9dd56be: identical workflow968b31e224, pinned clients, three CNs ×14 CPU/55 GiB with 12-GiB cache; TN 14 CPU/55 GiB with 5-GiB cache. Both runs/result checks pass.LOAD excludes DDL/preparation; query sums include all 22 queries and exclude warmup. One sequential pair does not establish statistical significance. TPCH combined three-CN RSS peak: 95.369 → 99.137 GiB; working-set peak: 135.168 → 124.451 GiB (15-second sampling). Historical local
dfb9dd56beacceptance completed five continuous Amway rounds /195 imports/6,931,020 rows on one PID under 22 GiB, zero OOM/retries/restarts/forced GC/deliberate pauses. These are historical acceptance results.