Repository navigation
refactor(vector): remove allocation_account.go; accounting belongs to mpool - #33054
Merged
Merged
Conversation
… mpool Delete pkg/container/vector/allocation_account.go and its test file. Vector no longer makes accounting decisions; callers allocate and grow through mpool directly. mpool now owns the rules the vector helpers used to enforce: - an accounted view charges every allocation (Alloc/Grow/ReallocZero are forced off-heap through a view, regardless of the caller's offHeap); - Alloc/Grow on a nil pool return an error instead of panicking; - size-limit and grow-overflow failures carry ErrAllocationAllocatorLimit. The remaining vector-only helpers (bitmap capacity, borrowed-backing materialization, stream size validation) move into vector.go. Shared test fixtures used by other vector tests move to mpool_view_fixtures_test.go. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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? |
Contributor
|
This pull request is merged. |
appendList fell back to a forward loop when the input overlapped the destination, only to reproduce the old smearing result (a test asserted every row became the first value). copy is memmove, so always copy: an overlapping input is now appended as it was before the call. Tests: - merge append_list_fastpath_test.go and append_varlen_pregrow_test.go into append_test.go; the aliased-input test now asserts the input values; - drop the short-mask panic test (pinned undefined partial state) and the element-width test (copy does not depend on width); - rename the guards test to TestAppendVarlenListSlowPath, since its cases never reach the pre-grow path, and run it on a plain mpool; - fail the pre-grow rollback test on a capped mpool instead of an allocation-account view; - move TestConstNullCleanAndUnionBatch to unionbatch_fastpath_test.go; - merge the three append benchmarks into append_bench_test.go. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Joining ErrAllocationAllocatorLimit onto mpool's size-limit errors broke callers that check the moerr code: moerr.IsMoErrCode type-asserts and does not unwrap, so TestWriteArena saw a non-ErrInternal error. Restore mpool's errors as on main. Vector's grow path types the failure itself, as the removed growOwned did: a size past GrowCapacity returns ErrAllocationAllocatorLimit before calling mp.Grow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test cancelled its context with defer, which runs before t.Cleanup, and derived it from t.Context(), which is cancelled before cleanups. The proxy runs on that context, so it could drop its connections before the db.Close cleanups ran; db.Close then failed with "bad connection" (seen in the UT coverage run). Derive ctx from context.Background() and cancel it in the first-registered cleanup, so it runs last. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
mo-bot review · Commit: task canceled or execution/log limit exceeded |
fengttt
added a commit
to fengttt/matrixone
that referenced
this pull request
Nov 22, 2026
Take matrixorigin#33054's file removals and consolidated append tests. The vector helpers keep this branch's strict owner-pool form (checkMP); the per-site allocData/allocArea/allocOwned wrappers collapse into one alloc, and growOwned no longer classifies growth failures as allocation-account errors. Port the merged tests to NewVec(typ, mp); drop output_lease_test.go (the scan owns its output pool on this branch) and the resurrected borrowed_helpers_test.go. Fix the SCA unsafe import in mpool_contract_test.go and the typecheck-tagged NewVec call.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Remove
pkg/container/vector/allocation_account.goandallocation_account_test.go. Memory accounting is mpool's responsibility; vector now allocates and grows through mpool directly.mpool contract changes
Alloc,GrowandReallocZerothrough an accounted view (WithAccount) are always off-heap and charged, regardless of the caller'soffHeapargument. Previously an on-heap request through a view went to the Go heap uncharged, so vector had to force off-heap itself.Alloc/Growon a nil*MPoolreturn an internal error instead of panicking.moerr.IsMoErrCodedoes not unwrap). Vector's grow path returnsErrAllocationAllocatorLimititself before callingmp.Grow, as the removedgrowOwneddid.vector changes
allocData/allocArea/allocOwnedremoved; callers usemp.Alloc(n, offHeap).growData/growAreamaterialize a borrowed backing, then callmp.Grow.allocationAccountInvalidreplaced by plainmoerrinternal errors (these were vector invariant checks).mpparameter; vector-only helpers (readSizeBytes, stream size validation, backing-storage checks, bitmap helpers) move tovector.go.mpool_view_fixtures_test.go.Tests
The 42 tests in
allocation_account_test.goare deleted.TestMPoolAccountedViewis updated for the new charging rule. Passing locally:pkg/common/mpool,pkg/container/...,pkg/objectio/...,pkg/sql/colexec/...,pkg/sql/plan/...,pkg/sql/compile,pkg/sql/util/...,pkg/vm/engine/readutil,pkg/vm/engine/disttae,pkg/vm/engine/tae/blockio,pkg/vm/process,pkg/vectorindex/....Append tests and
appendListappendListno longer falls back to a forward loop when the input overlaps the destination; it always usescopy(memmove). Previously an input taken from the vector's own unused capacity was smeared (every row became the first value), and a test asserted that. It is now appended as it was before the call.append_*_test.gofiles becomeappend_test.goandappend_bench_test.go. Dropped: the short-mask panic test (pinned undefined partial state) and the element-width test. The pre-grow rollback test now fails on a capped mpool instead of an allocation-account view.TestConstNullCleanAndUnionBatchmoves tounionbatch_fastpath_test.go.🤖 Generated with Claude Code