gavinchou commented on code in PR #47892:
URL: https://github.com/apache/doris/pull/47892#discussion_r1955072160


##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -971,12 +971,13 @@ bool BlockFileCache::try_reserve(const UInt128Wrapper& 
hash, const CacheContext&
 
     size_t max_size = queue.get_max_size();
     auto is_overflow = [&] {
-        return _disk_resource_limit_mode ? removed_size < size
-                                         : cur_cache_size + size - 
removed_size > _capacity ||
-                                                   (queue_size + size - 
removed_size > max_size) ||
-                                                   (query_context_cache_size + 
size -
-                                                            (removed_size + 
ghost_remove_size) >
-                                                    
query_context->get_max_cache_size());
+        return (_disk_resource_limit_mode || _need_evict_cache_in_advance)
+                       ? removed_size < size
+                       : cur_cache_size + size - removed_size > _capacity ||
+                                 (queue_size + size - removed_size > max_size) 
||
+                                 (query_context_cache_size + size -
+                                          (removed_size + ghost_remove_size) >
+                                  query_context->get_max_cache_size());

Review Comment:
   break down to readable conditions. e.g.
   ```suggestion
           bool insufficient_reclaimed = removed_size < size;
           bool insufficient_global_remain = cur_cache_size + size - 
removed_size > _capacity;
           bool insufficient_queue_remain = queue_size + size - removed_size > 
max_size;
           bool insufficient_query_remain = query_context_cache_size + size - 
(removed_size + ghost_remove_size) > query_context->get_max_cache_size();
           bool need_evict = _disk_resource_limit_mode || 
_need_evict_cache_in_advance;
           return need_evict ? insufficient_reclaimed
                             : insufficient_global_remain ||
                               insufficient_queue_remain ||
                               insufficient_query_remain;
   ```



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to