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



##########
File path: be/src/olap/page_cache.cpp
##########
@@ -21,35 +21,81 @@ namespace doris {
 
 StoragePageCache* StoragePageCache::_s_instance = nullptr;
 
-void StoragePageCache::create_global_cache(size_t capacity) {
+void StoragePageCache::create_global_cache(size_t capacity, double 
index_cache_ratio) {
     DCHECK(_s_instance == nullptr);
-    static StoragePageCache instance(capacity);
+    static StoragePageCache instance(capacity, index_cache_ratio);
     _s_instance = &instance;
 }
 
-StoragePageCache::StoragePageCache(size_t capacity)
-        : _cache(new_lru_cache("StoragePageCache", capacity)) {}
+StoragePageCache::StoragePageCache(size_t capacity, double index_cache_ratio)
+        : _index_cache_ratio(index_cache_ratio) {
+    if (index_cache_ratio == 0) {

Review comment:
       I think it is a good idea to use the percentage as index cache ratio 
because of the safety problem as you mentioned and could also avoid using the 
type cast. I will change the definition. Thank you very much!




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