Repository navigation
perf(disttae): reduce logtail replay allocations (cherry-pick #26234) - #26287
Conversation
## 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]>
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? |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No findings. The change safely reuses vectors from the already-required full batch conversion; ownership, lifetime, replay semantics, API compatibility, and error behavior remain intact while redundant allocations are removed. Existing discussions contain no actionable feedback. Formatting and diff checks pass; focused tests could not start because the checkout lacks the required cgo/libmo.dylib.
|
Queued — the merge queue status continues in this comment ↓. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed at head 8b363ea for the 4.2-dev context. The patch is byte-for-byte patch-equivalent to merged #26234. Proto-backed vectors remain non-owning views, the already-retained batch/RowEntry lifetime is unchanged, and removing the redundant wrappers introduces no leak, double free, wait edge, or accumulation. Full logtailreplay and disttae tests, full logtailreplay race, go vet, diff checks, and 3x allocation benchmarks passed locally (insert 992 B/12 allocs; delete 1312 B/15 allocs).
Merge Queue Status
This pull request spent 36 minutes 40 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks Failing checks: HintYou may have to fix your CI before adding the pull request to the queue again. Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 12 seconds in the queue, including 1 second running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26182
What this PR does / why we need it:
Cherry-picks #26234 to
4.2-dev.HandleRowsInsertandHandleRowsDeleteconverted the same protobuf vectorsindividually before converting the complete batch, creating redundant vector
wrappers on every replayed batch. This change reuses the vectors from the
single
ProtoBatchToBatchconversion and adds allocation benchmarks for bothpaths.