Repository navigation
fix(objectio): compact multi-term read filter marks - #28610
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.
Reviewed head e46f4e1 against live main/merge-base 24f2f6c. No blocking findings; approve.
The two-file change is a focused in-memory allocation fix, not a persisted/wire encoding change. For each valid row r, word r/64 and bit r%64 uniquely represent membership in the union. Range guards exclude invalid offsets and padding bits; duplicates are idempotent. Iterating words in order and removing the lowest set bit produces the same ascending, unique row coordinates as before, regardless of term order or individual term result order. Empty/single-term, NULL/type fail-open behavior and term-specific matching are unchanged.
The scratch bitset and result are per-call Go-owned storage. No shared mutation, pool/reuse generation, additional wait or cache-backed alias is introduced. Checked cache binding/error propagation and downstream selection/visibility filtering remain intact. Output storage is exactly 8matchedRows bytes plus the rounded bitset (~sourceRows/8 bytes); dense all-hit output therefore has a small extra bitmap allocation compared with the old shared marker/output backing array, while sparse searches eliminate the dominant 8sourceRows allocation. This tradeoff is appropriate for the reported allocation hotspot; it is not a claim that every match density or end-to-end workload is faster.
Validation: read the complete diff, issue #28609, live comments/review history, search constructors, matching/union path and cache/read consumers. Existing tests cover overlapping terms and conservative fallback, and the new allocation regression checks exact ordered hits across distant words. Independently checked 360 union/order model cases covering 0/1/63/64/65/127/128/129/8192 rows, duplicates, reversed/all/no matches and invalid offsets; this is a reference-model check, not execution of the native Go implementation. git diff --check passed. The author reports go test ./pkg/objectio -count=1; I did not independently rerun native tests or wait for CI. Head/base rechecked unchanged before submission.
Merge Queue Status
This pull request spent 39 minutes 13 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. 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 - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28609 ## What this PR does / why we need it: `ReadFilterSearch` used one `int64` marker per source row when merging multiple filter terms. For large object blocks this created substantial allocation churn and GC CPU. This PR replaces the row marker array with a compact bitset, preserves ascending row-order output, and allocates the result slice to its exact match count. It also adds a regression test that checks combined searches do not allocate a block-sized marker array. Tests: - `go test ./pkg/objectio -count=1` 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 - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28609 ## What this PR does / why we need it: `ReadFilterSearch` used one `int64` marker per source row when merging multiple filter terms. For large object blocks this created substantial allocation churn and GC CPU. This PR replaces the row marker array with a compact bitset, preserves ascending row-order output, and allocates the result slice to its exact match count. It also adds a regression test that checks combined searches do not allocate a block-sized marker array. Tests: - `go test ./pkg/objectio -count=1` 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 - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28609 ## What this PR does / why we need it: `ReadFilterSearch` used one `int64` marker per source row when merging multiple filter terms. For large object blocks this created substantial allocation churn and GC CPU. This PR replaces the row marker array with a compact bitset, preserves ascending row-order output, and allocates the result slice to its exact match count. It also adds a regression test that checks combined searches do not allocate a block-sized marker array. Tests: - `go test ./pkg/objectio -count=1` Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…xes (#29292) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: References #28530 and #28609. Backports #28799 and #28610 to `4.2-dev`. The mpool change remains a scoped mitigation, not a claim that all costs in #28530 are eliminated. ## What this PR does / why we need it: Backports two already-merged main fixes onto `4.2-dev` at `7a68d42c4ec151f9af5890ee56b4d24afd87b843`, preserving original authors and `cherry-pick -x` provenance: 1. **#28610** (`6ad98a5f5e8cbfd8f328836676f2186bfa2e09c7`): replace the multi-term `ReadFilterSearch` int64-per-source-row marks with a compact bitset and allocate the result to its exact size. Preserve deduplication, ascending row order, and the existing single-term and malformed-input paths. Include the allocation regression test. 2. **#28799** (`14e457608003381ef409fbf0c475e0a931633a28`): record conservative per-pool pointer-shard hints and restrict destroy-time on-heap ownership scans to those shards. Registry maps remain authoritative; free does not clear hints; noLock pools and public `OnHeapOutstanding()` behavior are unchanged. Include the correctness/concurrency tests and scale benchmark. ### Release-branch adaptations - Resolve the objectio import conflict by adding only `math/bits`; unrelated main-only imports/implementations are not brought over. - Omit the unrelated `pkg/tests/issues/issue_277xx_ddl_consistency_test.go` adjustment bundled with #28799: that test does not exist on `4.2-dev`. Keep all direct mpool regression coverage. - Preserve the release branch's existing allocation-account/lease implementation. Accounted allocations are off-heap and do not require on-heap hints. Only four files change. No catalog/schema migration, configuration, wire or on-disk format, dependencies, or CI workflow changes. No changes to release tags or running deployments. ### Validation Fresh local validation on Go 1.26.4, Darwin/arm64: - `GOWORK=off go list -mod=readonly ./pkg/common/mpool ./pkg/objectio`: PASS. - `GOWORK=off go test -mod=readonly -count=1 -timeout=120s ./pkg/common/mpool`: PASS. - `GOWORK=off go test -mod=readonly -race -json -count=1 -timeout=240s ./pkg/common/mpool`: PASS (full package). - Repository `mo-cgo-test` wrapper, each with `-race -count=100 -timeout=120s`: PASS for `TestOnHeapShardHintsAreConservativeAndExact` and `TestOnHeapShardHintsConcurrentPublicationAndCrossPoolFree`. Initial JSON durations were below timer resolution; the adaptive budget therefore used N=100. - `.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s ./pkg/objectio`: PASS (full package, including allocation and legacy predicate equivalence regressions; also a consumer of mpool). - `go build -mod=readonly` and `go vet -mod=readonly` for both owning packages with `GOWORK=off` and repository-local native include/library paths: PASS. Native prerequisites were built from this worktree's bundled thirdparty sources and CGo sources. - `git diff --check` and `gofmt -l` for all four changed files: PASS. - Self-review: exact ownership diagnostics, monotonic atomic hint publication, cross-pool frees, fixed-size hint storage, bitset bounds, result order and release-branch adaptations checked. No additional lifecycle, external wait or persistent state introduced. Full distributed BVT, end-to-end QA profiling and new performance benchmarks were not run for this backport. CI remains required; no end-to-end latency improvement is claimed from these unit tests. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28609
What this PR does / why we need it:
ReadFilterSearchused oneint64marker per source row when merging multiple filter terms. For large object blocks this created substantial allocation churn and GC CPU. This PR replaces the row marker array with a compact bitset, preserves ascending row-order output, and allocates the result slice to its exact match count. It also adds a regression test that checks combined searches do not allocate a block-sized marker array.Tests:
go test ./pkg/objectio -count=1