github-actions[bot] commented on code in PR #44135:
URL: https://github.com/apache/doris/pull/44135#discussion_r1845818705


##########
be/src/olap/memtable_memory_limiter.cpp:
##########
@@ -77,33 +78,41 @@ void 
MemTableMemoryLimiter::register_writer(std::weak_ptr<MemTableWriter> writer
     _writers.push_back(writer);
 }
 
-bool MemTableMemoryLimiter::_sys_avail_mem_less_than_warning_water_mark() {
+int64_t MemTableMemoryLimiter::_sys_avail_mem_less_than_warning_water_mark() {
     // reserve a small amount of memory so we do not trigger MinorGC
-    return doris::GlobalMemoryArbitrator::sys_mem_available() <
-           doris::MemInfo::sys_mem_available_warning_water_mark() +
-                   config::memtable_limiter_reserved_memory_bytes;
+    return doris::MemInfo::sys_mem_available_warning_water_mark() -
+           doris::GlobalMemoryArbitrator::sys_mem_available() +
+           config::memtable_limiter_reserved_memory_bytes;
 }
 
-bool MemTableMemoryLimiter::_process_used_mem_more_than_soft_mem_limit() {
+int64_t MemTableMemoryLimiter::_process_used_mem_more_than_soft_mem_limit() {
     // reserve a small amount of memory so we do not trigger MinorGC
-    return GlobalMemoryArbitrator::process_memory_usage() >
-           MemInfo::soft_mem_limit() - 
config::memtable_limiter_reserved_memory_bytes;
+    return GlobalMemoryArbitrator::process_memory_usage() - 
MemInfo::soft_mem_limit() +
+           config::memtable_limiter_reserved_memory_bytes;
 }
 
 bool MemTableMemoryLimiter::_soft_limit_reached() {
-    return _mem_tracker->consumption() >= _load_soft_mem_limit || 
_hard_limit_reached();
+    return _mem_tracker->consumption() > _load_soft_mem_limit || 
_hard_limit_reached();
 }
 
 bool MemTableMemoryLimiter::_hard_limit_reached() {
-    return _mem_tracker->consumption() >= _load_hard_mem_limit ||
-           _sys_avail_mem_less_than_warning_water_mark() ||
-           _process_used_mem_more_than_soft_mem_limit();
+    return _mem_tracker->consumption() > _load_hard_mem_limit ||
+           _sys_avail_mem_less_than_warning_water_mark() > 0 ||
+           _process_used_mem_more_than_soft_mem_limit() > 0;
 }
 
 bool MemTableMemoryLimiter::_load_usage_low() {
     return _mem_tracker->consumption() <= _load_safe_mem_permit;
 }
 
+int64_t MemTableMemoryLimiter::_need_flush() {

Review Comment:
   warning: method '_need_flush' can be made const 
[readability-make-member-function-const]
   
   be/src/olap/memtable_memory_limiter.h:59:
   ```diff
   -     int64_t _need_flush();
   +     int64_t _need_flush() const;
   ```
   
   ```suggestion
   int64_t MemTableMemoryLimiter::_need_flush() const {
   ```
   



-- 
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]

Reply via email to