Skip to content

fix(import): bound memory and pipeline uploads on 4.2-dev - #32065

Merged
XuPeng-SH merged 8 commits into
matrixorigin:4.2-devfrom
aptend:fix/4.2-dev-import-memory
Nov 11, 2026
Merged

XuPeng-SH merged 8 commits into
matrixorigin:4.2-devfrom
aptend:fix/4.2-dev-import-memory

Conversation

@aptend

@aptend aptend commented Nov 3, 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:

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 9a2948051e43ea3ad5d49e5651dfa9e62a5f01ec is based on 4.2-dev@c0532d1aa586b9be473eb82492d29e27861e095f, with five commits. Maintained design. Paired release PR: #32241.

  • Legacy partition EOF preflush retires all source D before replay, avoiding sibling self-wait. Until a complete metadata frame is handed off, the existing sinker/block-info/spool owns its successful objects. Partial flush, cancellation and failed decode remove only unhanded files; Free/Reset share one bounded cleanup deadline across partitions. Compact cleanup names stay in the existing private spool, avoiding a second object registry.
  • Protected publication Apply observes an atomic worker TTL/notification snapshot. Earlier/later renewal and unregister wake its existing expiration observer; stale replies from removed registrations cannot update a replacement. Exit cancels and joins the observer. Source-buffer admission, fixed-name tombstone layout and accepted-worker ownership are retained.
  • INSERT/MultiUpdate keep admitted compact metadata in memory, migrating unread records to the configured LOCAL spill service only on capacity denial. Legacy/raw-delete output streams per frame with delete-before-insert order. Files no longer use OS TMPDIR. Persistent object and transaction protocols are retained; no new setting, worker pool or polling interval is added.

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:

  • Physical LocalFS regressions cover late write failure/cancellation, Reset, partial consumer handoff, successful INSERT handoff, failed decode and successful-upload prefixes. Actual handed-off files remain; producer-owned files are removed. Earlier original-behavior overlays fail the ownership/TTL runtime oracles. The cleanup-deadline regression also fails before sharing the deadline.
  • Real worker/coordinator/FilterObject virtual-time tests cover expiry, extension, shortening, unregister, parent cancellation and stale renewal generations. The directly affected TTL/renewal tests pass 100 repetitions; final partition tests pass 100 repetitions per branch.
  • The final multi_update owning 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.
  • Local SCA compares against latest fetched main@61b5a4ee202578d2b186559f49af94b7c12b85a9. Its incremental selector selects ./..., including tests and reverse dependencies; Go 1.26.4, CGO and built thirdparties artifacts are used. Repository-pinned molint 222a0b8adf07 and golangci-lint v2.6.2 pass; lint reports zero issues:
go vet -mod=readonly -p=2 ./...
go vet -mod=readonly -p=2 -vettool=/d/mo-worktrees/v42-import-memory-lab-20261103/bin/molint ./...
golangci-lint run --timeout=25m --concurrency=2 --new-from-rev=61b5a4ee202578d2b186559f49af94b7c12b85a9 -c .golangci.yml ./...
make err-check

License/header checks and native builds pass. New GitHub CI and re-review are pending.

Historical workload evidence retains its original revisions/configurations:

  • Amway baseline attempt 2, 10d204b876, versus candidate attempt 4, 67179b6eed: identical workflow 93631633b7, importer 35e18afa1b, 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.
  • TPCH baseline, 10d204b876, versus port, dfb9dd56be: identical workflow 968b31e224, 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.
TPCH runner total Baseline Port Change
100G LOAD, 8 tables 311.592 s 347.026 s +11.37%
1T LOAD, 8 tables 3468.715 s 3130.165 s -9.76%
100G queries, all 3 measured rounds 288.795 s 302.525 s +4.75%
1T queries, all 2 measured rounds 2100.224 s 2127.282 s +1.29%

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 dfb9dd56be acceptance 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.

@aptend
aptend requested a review from XuPeng-SH as a code owner November 3, 2026 05:24
@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 Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: dfb9dd56be9573708add61fee2f89fd1b45931df

Review discussion changed before publication; a fresh contextual review is queued.

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

@XuPeng-SH

XuPeng-SH commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: dfb9dd56be9573708add61fee2f89fd1b45931df

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

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto 4.2-dev@bf15b1c7a8; current head 0cfe8ae001, still five commits.

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

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.

  1. 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.
  2. 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.

@XuPeng-SH

XuPeng-SH commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 0cfe8ae00165fe3c7174d5a0a9b961fc921355ad

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

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Addressed this review together with the same feature in #32241, at 13c0d350b5aa8f9beecd1415ce947fd592ebe0ea (five commits on 4.2-dev@9dd4d33e2b).

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.

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Fixed both new waiting-lifecycle findings in both release branches; head 3fd12ae50194e1126cbcf1a79be9e25e9eed2eee, five commits on 4.2-dev. Paired PR: #32241.

  • Partition replay self-wait: factor the existing tail finalization and run it for every legacy partition at Build EOF, before the first frame admission. All partition source/future D is retired before Eval can wait. Frame backing remains budgeted, delete-before-insert/frame ownership stays intact, and independently releasable pressure still uses cancellable waiting. Cancellation or flush failure retains every writer for Reset/Free. Admitted imports retain their existing path.
  • Protection expiry during admission: the protected Apply phase owns one cancellable expiration observer shared by its object jobs. Its timer follows actual TTL expiration, rechecks the worker's current TTL to honor renewal, and cancels admission/IO on expiry. Parent cancellation/phase exit stops and joins it. No per-object polling, worker pool or Worker/TTLChecker API change; existing cancel/drain keeps live buffers owned until retirement.

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 (745d25375d), actual err-check/licenses and native builds pass. Test-owned services/data are removed. Updated body/design; API re-review requested. New-head GitHub CI is pending.

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

CI correction pushed at 60cb309bd063a6a99d0d5a82825d2b129f9828e5 (paired release correction in #32241 and #32065).

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.

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the five commits onto latest 4.2-dev@c8264f1e6fa6cbe79eb8734677bc147a7482184d; new head b9c03d7a445a74c4eadb76924555432eab1d4642.

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.

@XuPeng-SH

XuPeng-SH commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: b9c03d7a445a74c4eadb76924555432eab1d4642

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

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Updated to 6adfea171977901fecbf085314b0f403418653c2; paired lifecycle corrections are applied in both #32241 and #32065.

The repeated review findings exposed ownership/termination boundaries missed when introducing preflush and the protection observer. The fix now covers their full local transitions:

  • Successful preflush objects remain owned by existing sinker/block-info/private-spool state until complete metadata handoff. On late failure/cancellation/Reset, pending files are removed; partially handed-off files remain. Failed decoding cannot retire the handoff cursor. Cleanup reads compact names, not full raw-key frames, and all partitions share one query-independent cleanup deadline.
  • Worker TTL and its notification are read under one lock. Earlier/later renewals and unregister wake the observer; removed-generation replies cannot overwrite a replacement. Tests use actual worker/coordinator/FilterObject state and virtual time.
  • Metadata files now use configured LOCAL storage. 4.2 additionally reuses existing query/CN spill bytes and FD reservations, with pre-write growth and release on physical Close; no new quota parameter. Both consumers reject a cumulatively oversized write before changing the file.

Final validation: owning colexec, insert, multi_update suites pass normal and race (378 named cases per mode); partition regression passes 100 repetitions. TTL/renewal 100-repeat evidence and unchanged publication/ioutil normal/race evidence remain source-valid. Original ownership/TTL behavior fails the runtime controls; a no-admission mutation fails both 4.2 quota oracles. Both final native binaries pass 20 SQL statements with partitioned DML and rollback/commit. Pinned local SCA against main@00da05219fb8dce0266de4efa7c4bbfac06491de selects ./... (tests/reverse dependencies), and vet/molint/lint pass with zero lint findings. Error checks, licenses and native builds pass.

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.

@XuPeng-SH

XuPeng-SH commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 6adfea171977901fecbf085314b0f403418653c2

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

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@aptend

aptend commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the delete-key spool ownership finding from review 5841730725 in 9a2948051e43ea3ad5d49e5651dfa9e62a5f01ec, rebased onto 4.2-dev@c0532d1aa586b9be473eb82492d29e27861e095f; five commits retained.

The earlier correction covered INSERT/MultiUpdate output spools but missed the transaction-local dedup file. This follow-up reuses MetadataSpool for that file too: configured LOCAL placement, native query/CN disk+FD ownership, bucket-table admission before Truncate, and record admission before WriteAt. Duplicate lookups need no additional reservation. Existing Reset/Free closes the owner and refunds storage; no new parameter, algorithm, registry or worker is added.

The pre-fix real prepareDeleteBatches regression charges only 896 bytes, missing the 524,352 bytes held by its dedup file (512-KiB heads + two RowID records). Fixed code charges both files, emits the two distinct rows correctly and returns all disk/FD claims on Reset. Additional small quota controls cover header rejection, append rejection before file growth, dedup hits at capacity and Close/reuse. An audit of every production file creator in the complete PR scope found only the common native spool factory and the existing budgeted materialized-source factory.

Validation: focused regressions pass; full multi_update package passes normal/race (150 named tests each); pinned local SCA against main@61b5a4ee202578d2b186559f49af94b7c12b85a9 selects ./... including tests/reverse dependencies, and vet/molint/lint pass (zero lint issues). make err-check and native build pass. A binary stamped with this final commit passes 20 public SQL statements covering partitioned DML, same-transaction insert/delete, rollback/commit and exact counts. This is a functional SQL control, not a SQL quota-exhaustion or throughput result. Unchanged native spool creation/FD/cancellation evidence remains source-valid.

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.

@XuPeng-SH

XuPeng-SH commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 9a2948051e43ea3ad5d49e5651dfa9e62a5f01ec

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

@XuPeng-SH

XuPeng-SH commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 18efc7994278a7ca02ad8345e9d4933448bd85de

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

This branch was successfully deployed

No deployments
ci — 3be73a21 Deployed Nov 11, 2026 by aptend
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/enhancement size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants