dataroaring commented on code in PR #56948:
URL: https://github.com/apache/doris/pull/56948#discussion_r2428309679
##########
be/src/olap/memtable.h:
##########
@@ -213,6 +214,21 @@ class MemTable {
// Used to wrapped by to_block to do exception handle logic
Status _to_block(std::unique_ptr<vectorized::Block>* res);
+ int64_t _adaptive_write_buffer_size() const {
+ const int64_t current_load_mem_value =
MemoryProfile::load_current_usage();
+ int64_t factor = 4;
+ // Memory usage intervals:
+ // (80 %, 100 %] → 1× buffer
+ // (50 %, 80 %] → 2× buffer
+ // [0 %, 50 %] → 4× buffer
+ if (current_load_mem_value > (_load_mem_limit * 4) / 5) { // > 80 %
+ factor = 1;
+ } else if (current_load_mem_value > _load_mem_limit / 2) { // > 50 %
+ factor = 2;
+ }
+ return config::write_buffer_size * factor;
+ }
Review Comment:
put it to .cpp
--
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]