jacktengg opened a new pull request, #68399:
URL: https://github.com/apache/doris/pull/68399
### What problem does this PR solve?
Issue Number: N/A
Related PR: N/A
Problem Summary: MemTable tracks its shared_ptr element array through
DorisVector, but ordinary make_shared allocations for each RowInBlock and its
control block bypass Doris memory accounting. This underestimates
memory_usage() during writes and the additional row references created for MOW
Cluster Key sorting, affecting flush thresholds and memory limits. Use
allocate_shared with CustomStdAllocator on both paths and track the Tie byte
buffer with DorisVector. Shared ownership and row/LSN ordering remain
unchanged, and deallocation balances accounting in the existing MemTable
tracker scopes, including aggregation and asynchronous cleanup.
### Release note
Correct MemTable memory accounting for row objects, shared_ptr control
blocks and sorting tie buffers so flush thresholds and memory limits include
these allocations.
### Check List (For Author)
- Test: Unit Test
- ./run-be-ut.sh --run --filter='*MemTable*' -j 24: all 17 tests pass
under ASAN, including 7 new memory tracking cases.
- ./build.sh --be -j 24: ASAN BE build.
- clang-format 16, check-format.sh, check-build-hygiene.sh and git diff
--check pass.
- clang-tidy attempted; no diagnostics on changed lines. Its nonzero
exit is blocked by the pre-existing unmatched NOLINTEND in
be/src/core/types.h:576.
- Behavior changed: Yes, MemTable memory statistics now include the row
objects, control blocks and tie buffers used by flush and memory limits.
- Does this need documentation: No
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]