Skip to content

Conversation

@kaijchen
Copy link
Member

backport #41018, #41278, #41245

## Proposed changes

apache#40912 has changed meaning of `write_mem` in memtable memory limiter.
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.
…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.
## 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`
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@kaijchen
Copy link
Member Author

run buildall

@kaijchen kaijchen changed the title [fix](load) fix memtable memory limiter policy for #40912 (#41018) [fix](load) memtable memory limiter policy changes followup #40912 (#41018) Oct 21, 2024
@liaoxin01 liaoxin01 merged commit 5285cbc into apache:branch-3.0 Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants