Repository navigation
fix(bitmap): address review comments of #33144 - #33231
Merged
Merged
Conversation
Reviews of matrixorigin#33144 (bitmaps own their words through an mpool) landed after merge. Fixes for the confirmed findings: - tae dedup: BatchDedup errors other than OkExpectedPossibleDup (bloom filter load, candidate bitmap allocation) were treated as "no key in block", so persistedGetDuplicatedRows, persistedContains and the workspace tombstone probe could miss an existing key. Propagate them. - bitmap views: a view of a read-only bitmap past that bitmap's end read its shared words beyond Len, so Contains disagreed with Count and Marshal produced an invalid encoding. Stop such a view at the source's end. - nulls: Or of two empty inputs, and the "<=> is never NULL" / JSON-numeric comparison kernels, reset the result's bitmap and so returned the validity storage the result had reserved; later in-place Adds then allocated and could panic at the pool cap. Clear in place instead (nulls Gobra proof re-run: 0 errors). - aggexec: setting empty groups to NULL grew the bitmap in place and could panic; reserve it first and return the error from flushAll. - vector: Allocated omitted owned null-bitmap capacity that CleanOnlyData keeps, so size-limited buffers under-counted retained pool memory. - vector/cxcall: FillRawPtrLen called Ptr on a shifted window bitmap, which panics; hand native code a clean copy kept alive across the call. - batch: OwnReadOnlyVectors freed an original still referenced by a later alias column when a copy failed; copy all first, then swap and free. - tae scan: free loaded vectors, the row-ID vector and the I/O release on delete-bitmap allocation failure; reserve the merged delete bitmap so its Adds cannot fail. 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. |
3 of 7 tasks
Contributor
|
mo-bot review · Commit: "interrupted" |
3 tasks done
XuPeng-SH
added a commit
that referenced
this pull request
Nov 25, 2026
#33240) ## What type of PR is this? - [x] BUG - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: Related to #33030. Follow-up to #33144 and #33231. ## What this PR does / why we need it: After bitmap allocations moved into mpool, converting frontend results with NULLs could exhaust the pool while copying the temporary bitmap. That copy panicked and bypassed cleanup of the partial batch. Set NULLs on the destination vector and return allocation errors through the existing batch cleanup. Extend the bitmap only through the word containing the NULL row so rows in the same word can be marked without another growth call. The physical word requirement is unchanged from growing to the row itself. Columns without NULLs allocate no bitmap, and an early isolated NULL does not reserve bitmap storage for the whole column. Workspace tombstone lookup returned probe errors from its lower layer, but the caller ignored them and could classify a deleted primary key as a live duplicate. Return the original error before dedup continues. Propagate allocation failures while marking or publishing a deleted candidate and release persisted block data and selection storage on failure. Preserve partial filtering for the existing write-write conflict path when candidate copyback succeeds. Regression coverage includes pool limits and cleanup, word boundaries, NULL versus empty values, a persisted workspace tombstone, cancellation and missing objects, and the error returned when copying a delete back during a write-write conflict. Pinned local frontend microbenchmarks against the PR base (4096 rows, six samples per revision, median): | NULL distribution | INT64 time delta | VARCHAR time delta | | --- | ---: | ---: | | None | -0.4% | -3.4% | | 1 in 97 | +3.7% | -1.8% | | Half | -4.2% | -1.0% | | All | -9.4% | -8.0% | These are result conversion microbenchmarks. They do not measure end-to-end query latency. Validation: - Frontend conversion regressions and the full frontend package passed with `-race -tags matrixone_test`. - TAE workspace tombstone/dedup regressions and full `txnimpl` race passed. The optimization only touched frontend files. - Incremental gofmt, go vet, molint, and golangci-lint passed for frontend and txnimpl.
fengttt
added a commit
to fengttt/matrixone
that referenced
this pull request
Nov 28, 2026
The branch was stacked on bitmap-mpool-ownership (matrixorigin#33144), which has since been squash-merged into main with its review fixes (matrixorigin#33231). This merge takes main for everything that branch carried, and keeps only this PR's own changes on top: the row-selection primitives, UnionByMask, their Gobra contracts, and the RemapList package decision in the design doc. Adapted to main: Batch.UnionByMask rejects a selected batch (matrixorigin#33184), and tests use NewWithSize (batch.New removed in matrixorigin#33199). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 type of PR is this?
Which issue(s) this PR fixes:
issue #33030
What this PR does / why we need it:
This PR follows up on #33144 (bitmaps own their words through an mpool). That PR merged while review comments were still open: the CHANGES_REQUESTED reviews from iamlinjunhong and the mo-bot review, plus the Codex automated review. This PR addresses those comments. Each finding was checked against the merged code on main, and every confirmed one is fixed here.
Review findings addressed
tae/tables/base.go,txnimpl/table.go).BatchDeduperrors other thanOkExpectedPossibleDup(bloom filter load, candidate bitmap allocation) were treated as "no key in this block".GetByFiltercould then report an existing key absent, andDedupSnapByPKcould miss a duplicate.persistedGetDuplicatedRows,persistedContainsand the workspace tombstone probe.bitmap_view.go). A view of a read-only bitmap extending past that bitmap'sLenread its shared words beyondLen.Containsthen disagreed withCount, andMarshalproduced an encoding thatValidaterejects.Reset(json_numeric_comparison.go, also the empty-union resets).Reset()returned the result's reserved null storage, so later in-placeAdds allocated and could panic at the pool cap.Clear()in the JSON/numeric comparison and the three<=>kernels infunc_compare.go.nulls.Orof two empty inputs now clears the result in place and keeps its length and storage. ThenullsGobra proof was re-run: 0 errors.aggexec/result.go). Setting empty groups to NULL grew the bitmap in place.PreExtendNulls.flushAllnow returns the error toFlush.Vector.Allocatedomits owned bitmap capacity (vector.go).CleanOnlyDatakeeps the pool-charged bitmap, but size-limited buffers did not see it.Ptr, which panics (FillRawPtrLen,cxcall.go).OwnReadOnlyVectorsfrees an original still referenced by a later alias (batch.go).tae/tables/pnode.go).releaseon that exit. The merged delete bitmap is also reserved for every row the merge can set, so itsAdds cannot fail.tae/tables/utils.go).Also removed a duplicated doc comment on
Bitmap.WordsCovering.Not changed here
The P2 finding that
Bitmapallocates its own words, contrary to the original text of #33030, is a design question, not a code defect. The follow-up comment on #33030 ("Give nulls a mpool") is what #33144 implements. That decision should be recorded on the issue.Tests
New regression tests:
TestBitmapViewOfViewStopsAtSourceEnd(fails on main)TestOrOfEmptyKeepsReservedStorage(fails on main)TestFlushAllEmptyGroupNullsAtPoolCapTestAllocatedCountsOwnedNullsTestFillRawPtrLenShiftedWindowNulls(Ptrpanics on main)TestOwnReadOnlyVectorsLeavesBatchOnDupError, which replaces the old test and now places an aliased column around the column whose copy failsThe dedup error propagation and the two TAE scan cleanup paths have no fault-injection tests. Each would need a persisted TAE object whose probe or scan allocation fails.
Local runs, all passing:
go test -tags matrixone_testovercommon/bitmap,container/{nulls,vector,batch},sql/colexec/{aggexec,group,hashbuild,mergeorder,partition,projection,filter},sql/colexec,sql/plan/function,vm/process,vm/engine/disttae,vm/engine/tae/{tables,containers,txn/txnimpl}.make static-checkpasses on the touched packages.🤖 Generated with Claude Code