This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch spill_and_reserve
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 330e0d3dae2cace08d33adc03d30bd1914db810d
Author: yiguolei <676222...@qq.com>
AuthorDate: Thu Sep 19 13:56:39 2024 +0800

    [bugfix](cache) the cache capacity is wrong when memusage > soft memlimit 
(#40961)
    
    ## Proposed changes
    
    bug is introduced by https://github.com/apache/doris/pull/40542
    
    Co-authored-by: yiguolei <yiguo...@gmail.com>
---
 be/src/common/daemon.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/be/src/common/daemon.cpp b/be/src/common/daemon.cpp
index 3bd0de7ebb6..6e500ef6d59 100644
--- a/be/src/common/daemon.cpp
+++ b/be/src/common/daemon.cpp
@@ -245,10 +245,14 @@ void refresh_cache_capacity() {
         auto cache_capacity_reduce_mem_limit = uint64_t(
                 doris::MemInfo::soft_mem_limit() * 
config::cache_capacity_reduce_mem_limit_frac);
         int64_t process_memory_usage = 
doris::GlobalMemoryArbitrator::process_memory_usage();
+        // the rule is like this:
+        // 1. if the process mem usage < soft memlimit * 0.6, then do not need 
adjust cache capacity.
+        // 2. if the process mem usage > soft memlimit * 0.6 and process mem 
usage < soft memlimit, then it will be adjusted to a lower value.
+        // 3. if the process mem usage > soft memlimit, then the capacity is 
adjusted to 0.
         double new_cache_capacity_adjust_weighted =
                 process_memory_usage <= cache_capacity_reduce_mem_limit
                         ? 1
-                        : std::min<double>(
+                        : std::max<double>(
                                   1 - (process_memory_usage - 
cache_capacity_reduce_mem_limit) /
                                                   
(doris::MemInfo::soft_mem_limit() -
                                                    
cache_capacity_reduce_mem_limit),


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to