Repository navigation
fix: return transfer slab allocation errors - #26396
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed the exact head against the latest main. The allocation error now propagates through both sorted merge and reshape before input loading/writer creation/transfer-table publication. Slab ownership remains single-owner across fresh, pooled, error, and transfer paths; no new wait or unbounded-growth edge was introduced. Focused allocation-failure/success tests, adaptive race stress (N=100 per test), full mergesort package race, build/vet/package tests, and TestTransferInMerge all pass. No blocking findings.
Merge Queue Status
This pull request spent 2 minutes 33 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26396 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.
Failing checks:
HintYou 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. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26376 ## What this PR does / why we need it: `getTransferSlab` converted a normal `mpool.MakeSlice` allocation error into a panic. Both sorted merge and reshape allocate this transfer bookkeeping before writing output, so a recoverable TN memory-admission failure could terminate the TN worker process. Return the allocator error from `getTransferSlab` and propagate it through both merge shapes to the existing `DoMergeAndWrite` error path. Successful slab pooling and `TransferTable` ownership transfer are unchanged. This PR intentionally does not change merge memory admission policy or the separate phase-2 deadline/budget design tracked by matrixorigin#26377. Tests use a real capacity-limited `mpool` to verify the direct allocation contract and both merge branches return before loading input, creating a writer, or publishing a transfer table. Tested with: ```text go build -mod=readonly ./pkg/vm/engine/tae/mergesort/... go vet -mod=readonly ./pkg/vm/engine/tae/mergesort/... .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s ./pkg/vm/engine/tae/mergesort/... .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s -run '^TestTransferInMerge$' ./pkg/vm/engine/tae/db/test .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -run '^TestGetTransferSlabReturnsAllocationError$' ./pkg/vm/engine/tae/mergesort .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -run '^TestDoMergeAndWriteReturnsTransferSlabAllocationError$' ./pkg/vm/engine/tae/mergesort .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s ./pkg/vm/engine/tae/mergesort/... ``` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26376 ## What this PR does / why we need it: `getTransferSlab` converted a normal `mpool.MakeSlice` allocation error into a panic. Both sorted merge and reshape allocate this transfer bookkeeping before writing output, so a recoverable TN memory-admission failure could terminate the TN worker process. Return the allocator error from `getTransferSlab` and propagate it through both merge shapes to the existing `DoMergeAndWrite` error path. Successful slab pooling and `TransferTable` ownership transfer are unchanged. This PR intentionally does not change merge memory admission policy or the separate phase-2 deadline/budget design tracked by matrixorigin#26377. Tests use a real capacity-limited `mpool` to verify the direct allocation contract and both merge branches return before loading input, creating a writer, or publishing a transfer table. Tested with: ```text go build -mod=readonly ./pkg/vm/engine/tae/mergesort/... go vet -mod=readonly ./pkg/vm/engine/tae/mergesort/... .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s ./pkg/vm/engine/tae/mergesort/... .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s -run '^TestTransferInMerge$' ./pkg/vm/engine/tae/db/test .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -run '^TestGetTransferSlabReturnsAllocationError$' ./pkg/vm/engine/tae/mergesort .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -run '^TestDoMergeAndWriteReturnsTransferSlabAllocationError$' ./pkg/vm/engine/tae/mergesort .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s ./pkg/vm/engine/tae/mergesort/... ``` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26376 ## What this PR does / why we need it: `getTransferSlab` converted a normal `mpool.MakeSlice` allocation error into a panic. Both sorted merge and reshape allocate this transfer bookkeeping before writing output, so a recoverable TN memory-admission failure could terminate the TN worker process. Return the allocator error from `getTransferSlab` and propagate it through both merge shapes to the existing `DoMergeAndWrite` error path. Successful slab pooling and `TransferTable` ownership transfer are unchanged. This PR intentionally does not change merge memory admission policy or the separate phase-2 deadline/budget design tracked by matrixorigin#26377. Tests use a real capacity-limited `mpool` to verify the direct allocation contract and both merge branches return before loading input, creating a writer, or publishing a transfer table. Tested with: ```text go build -mod=readonly ./pkg/vm/engine/tae/mergesort/... go vet -mod=readonly ./pkg/vm/engine/tae/mergesort/... .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s ./pkg/vm/engine/tae/mergesort/... .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s -run '^TestTransferInMerge$' ./pkg/vm/engine/tae/db/test .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -run '^TestGetTransferSlabReturnsAllocationError$' ./pkg/vm/engine/tae/mergesort .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -run '^TestDoMergeAndWriteReturnsTransferSlabAllocationError$' ./pkg/vm/engine/tae/mergesort .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=240s ./pkg/vm/engine/tae/mergesort/... ``` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #26376
What this PR does / why we need it:
getTransferSlabconverted a normalmpool.MakeSliceallocation error into apanic. Both sorted merge and reshape allocate this transfer bookkeeping before
writing output, so a recoverable TN memory-admission failure could terminate the
TN worker process.
Return the allocator error from
getTransferSlaband propagate it through bothmerge shapes to the existing
DoMergeAndWriteerror path. Successful slab poolingand
TransferTableownership transfer are unchanged. This PR intentionally doesnot change merge memory admission policy or the separate phase-2 deadline/budget
design tracked by #26377.
Tests use a real capacity-limited
mpoolto verify the direct allocation contractand both merge branches return before loading input, creating a writer, or
publishing a transfer table.
Tested with: