xiaokang commented on code in PR #16758:
URL: https://github.com/apache/doris/pull/16758#discussion_r1106530628


##########
be/src/olap/rowset/segment_v2/inverted_index_cache.cpp:
##########
@@ -49,6 +49,19 @@ void 
InvertedIndexSearcherCache::create_global_instance(size_t capacity, uint32_
 InvertedIndexSearcherCache::InvertedIndexSearcherCache(size_t capacity, 
uint32_t num_shards)
         : 
_mem_tracker(std::make_unique<MemTracker>("InvertedIndexSearcherCache")) {
     SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get());
+    uint64_t fd_number = config::min_file_descriptor_number;
+    struct rlimit l;
+    int ret = getrlimit(RLIMIT_NOFILE, &l);
+    if (ret != 0) {
+        LOG(WARNING) << "call getrlimit() failed. errno=" << strerror(errno)
+                     << ", use default configuration instead.";
+    } else {
+        fd_number = static_cast<uint64_t>(l.rlim_cur);
+    }
+
+    uint64_t open_searcher_limit = fd_number / 3 * 2;

Review Comment:
   It's better to use a dedicated config, and check it's less than 
min_file_descriptor_number.



##########
be/src/olap/lru_cache.h:
##########
@@ -322,6 +324,9 @@ class LRUCache {
 
     // Separate from constructor so caller can easily make an array of LRUCache
     void set_capacity(size_t capacity) { _capacity = capacity; }
+    void set_element_count_limit(uint32_t element_count_limit) {
+        _element_count_limit = element_count_limit;

Review Comment:
   suggest a name _count_capacity



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