Skysheepwang commented on a change in pull request #5008:
URL: https://github.com/apache/incubator-doris/pull/5008#discussion_r542993176



##########
File path: be/src/olap/rowset/segment_v2/page_io.cpp
##########
@@ -112,7 +112,7 @@ Status PageIO::read_and_decompress_page(const 
PageReadOptions& opts, PageHandle*
     auto cache = StoragePageCache::instance();
     PageCacheHandle cache_handle;
     StoragePageCache::CacheKey cache_key(opts.rblock->path(), 
opts.page_pointer.offset);
-    if (opts.use_page_cache && cache->lookup(cache_key, &cache_handle)) {
+    if (opts.use_page_cache && cache->is_cache_available(opts.type) && 
cache->lookup(cache_key, &cache_handle, opts.type)) {

Review comment:
       I choose to make the `is_cache_available()` check as an interface 
basically for two reasons:
   
   1. If the check is failed (which means that the percentage is set to 0 or 
100), the `lookup()` and `insert()` method will not be called, which could save 
some of the cost of parameter passing.
   2. It will do minimal changes to the original `read_and_decompress_page()` 
method in page_io.cpp and remain its design on whether call the `lookup()` and 
`insert()` methods.




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

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