-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve](load) more accurate memtable memory usage and new flush policy #44135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…40912) 1. Add memtype to memtable, and save a weak ptr vector in memtable writer, so that we could get different memory usage by traverse the vector. 2. Using scoped memory usage to compute the mem usage of a memtable. 3. CHECK if the tracker is 0 when the memtable flush success. --------- Co-authored-by: yiguolei <yiguolei@gmail.com>
This PR is a followup to change the active memtable flush policy accordingly. It also changed: 1. The amount of memtable writers selected in one flush. 2. The memtable writers are selected in orders of its size.
## Proposed changes Previously, `mem_usage = write_mem + flush_mem`, because `active_mem` is included in `write_mem`. After apache#40912, `write_mem` becomes `queue_mem`, which no longer includes `active_mem`. This PR fixes this problem, by setting `mem_usage = active_mem + queue_mem + flush_mem`
…he#41278) ## Proposed changes apache#41018 used priority queue when selecting memtables to flush. But the compare function is wrong and causing the order to be the opposite. > Note that the Compare parameter is defined such that it returns true if its first argument comes before its second argument in a weak ordering. But because the priority queue outputs largest elements first, the elements that "come before" are actually output last. That is, the front of the queue contains the "last" element according to the weak ordering imposed by Compare. This PR fixes the compare function to make larger memtables come front.
|
run buildall |
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
| return _mem_tracker->consumption() <= _load_safe_mem_permit; | ||
| } | ||
|
|
||
| int64_t MemTableMemoryLimiter::_need_flush() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method '_need_flush' can be made const [readability-make-member-function-const]
be/src/olap/memtable_memory_limiter.h:59:
- int64_t _need_flush();
+ int64_t _need_flush() const;| int64_t MemTableMemoryLimiter::_need_flush() { | |
| int64_t MemTableMemoryLimiter::_need_flush() const { |
backport #40912 #41018 #41245 #41278