Repository navigation
perf(disttae): reduce logtail replay allocations - #26234
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 review done. I didn't find any merge-blocking correctness, lifecycle, or unhappy-path issues in the current diff.
Merge Queue Status
This pull request spent 3 hours 12 minutes 12 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. Requeued — the merge queue status continues in this comment ↓. |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No findings. The change safely reuses the already-retained decoded batch; protobuf-backed vectors do not own or free input buffers, so behavior and lifecycle are preserved while redundant wrappers are removed. Existing PR discussions contain no actionable review feedback. Focused tests could not run because the checkout lacks cgo/libmo.dylib.
Merge Queue Status
This pull request spent 28 minutes 16 seconds in the queue, with no time running CI. ReasonPull request #26234 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.
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
|
…#26287) Cherry-picks #26234 to `4.2-dev`. `HandleRowsInsert` and `HandleRowsDelete` converted the same protobuf vectors individually before converting the complete batch, creating redundant vector wrappers on every replayed batch. This change reuses the vectors from the single `ProtoBatchToBatch` conversion and adds allocation benchmarks for both paths. Approved by: @gouhongshen, @XuPeng-SH
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26182 ## What this PR does / why we need it: `HandleRowsInsert` and `HandleRowsDelete` converted the same protobuf vectors individually before converting the complete batch, creating redundant vector wrappers on every replayed batch. Reuse the vectors from the single `ProtoBatchToBatch` conversion instead, and add allocation benchmarks for both paths. On Apple M1 Pro, the benchmarks changed as follows: | Benchmark | Before | After | | --- | --- | --- | | Insert | 1,344 B/op, 14 allocs/op | 992 B/op, 12 allocs/op | | Delete | 1,840 B/op, 18 allocs/op | 1,312 B/op, 15 allocs/op | Validation: - `mo-cgo-test -count=1 -timeout=180s ./pkg/vm/engine/disttae/logtailreplay` - `mo-cgo-test -count=1 -timeout=240s ./pkg/vm/engine/disttae` - CGo-aware compile checks for both packages - Allocation benchmarks with `-benchmem -count=3` `make static-check` still reports the same pre-existing unused identifiers in `pkg/common/malloc/sane_allocator_cache.go` on both the clean base and this change. 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? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26182 ## What this PR does / why we need it: `HandleRowsInsert` and `HandleRowsDelete` converted the same protobuf vectors individually before converting the complete batch, creating redundant vector wrappers on every replayed batch. Reuse the vectors from the single `ProtoBatchToBatch` conversion instead, and add allocation benchmarks for both paths. On Apple M1 Pro, the benchmarks changed as follows: | Benchmark | Before | After | | --- | --- | --- | | Insert | 1,344 B/op, 14 allocs/op | 992 B/op, 12 allocs/op | | Delete | 1,840 B/op, 18 allocs/op | 1,312 B/op, 15 allocs/op | Validation: - `mo-cgo-test -count=1 -timeout=180s ./pkg/vm/engine/disttae/logtailreplay` - `mo-cgo-test -count=1 -timeout=240s ./pkg/vm/engine/disttae` - CGo-aware compile checks for both packages - Allocation benchmarks with `-benchmem -count=3` `make static-check` still reports the same pre-existing unused identifiers in `pkg/common/malloc/sane_allocator_cache.go` on both the clean base and this change. 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? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26182 ## What this PR does / why we need it: `HandleRowsInsert` and `HandleRowsDelete` converted the same protobuf vectors individually before converting the complete batch, creating redundant vector wrappers on every replayed batch. Reuse the vectors from the single `ProtoBatchToBatch` conversion instead, and add allocation benchmarks for both paths. On Apple M1 Pro, the benchmarks changed as follows: | Benchmark | Before | After | | --- | --- | --- | | Insert | 1,344 B/op, 14 allocs/op | 992 B/op, 12 allocs/op | | Delete | 1,840 B/op, 18 allocs/op | 1,312 B/op, 15 allocs/op | Validation: - `mo-cgo-test -count=1 -timeout=180s ./pkg/vm/engine/disttae/logtailreplay` - `mo-cgo-test -count=1 -timeout=240s ./pkg/vm/engine/disttae` - CGo-aware compile checks for both packages - Allocation benchmarks with `-benchmem -count=3` `make static-check` still reports the same pre-existing unused identifiers in `pkg/common/malloc/sane_allocator_cache.go` on both the clean base and this change. 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 #26182
What this PR does / why we need it:
HandleRowsInsertandHandleRowsDeleteconverted the same protobuf vectorsindividually before converting the complete batch, creating redundant vector
wrappers on every replayed batch. Reuse the vectors from the single
ProtoBatchToBatchconversion instead, and add allocation benchmarks for bothpaths.
On Apple M1 Pro, the benchmarks changed as follows:
Validation:
mo-cgo-test -count=1 -timeout=180s ./pkg/vm/engine/disttae/logtailreplaymo-cgo-test -count=1 -timeout=240s ./pkg/vm/engine/disttae-benchmem -count=3make static-checkstill reports the same pre-existing unused identifiers inpkg/common/malloc/sane_allocator_cache.goon both the clean base and thischange.