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


##########
be/src/olap/rowset/segment_v2/inverted_index_cache.cpp:
##########
@@ -43,12 +43,20 @@ InvertedIndexSearcherCache* 
InvertedIndexSearcherCache::_s_instance = nullptr;
 IndexSearcherPtr InvertedIndexSearcherCache::build_index_searcher(const 
io::FileSystemSPtr& fs,
                                                                   const 
std::string& index_dir,
                                                                   const 
std::string& file_name) {
-    DorisCompoundReader* directory =
-            new DorisCompoundReader(DorisCompoundDirectory::getDirectory(fs, 
index_dir.c_str()),
-                                    file_name.c_str(), 
config::inverted_index_read_buffer_size);
+    bool open_idx_file_cache = true;
+    DorisCompoundReader* directory = new DorisCompoundReader(
+            DorisCompoundDirectory::getDirectory(fs, index_dir.c_str()), 
file_name.c_str(),
+            config::inverted_index_read_buffer_size, open_idx_file_cache);
+
     auto closeDirectory = true;
-    auto index_searcher =
-            std::make_shared<lucene::search::IndexSearcher>(directory, 
closeDirectory);
+    auto reader = lucene::index::IndexReader::open(
+            directory, config::inverted_index_read_buffer_size, 
closeDirectory);
+
+    bool close_reader = true;
+    auto index_searcher = 
std::make_shared<lucene::search::IndexSearcher>(reader, close_reader);
+
+    directory->getDorisIndexInput()->setIdxFileCache(false);

Review Comment:
   add comment for two setIdxFileCache function call



##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.h:
##########
@@ -161,6 +170,8 @@ class DorisCompoundDirectory::FSIndexInput : public 
lucene::store::BufferedIndex
     const char* getObjectName() const override { return getClassName(); }
     static const char* getClassName() { return "FSIndexInput"; }
 
+    void setIdxFileCache(bool index) override { _io_ctx.read_segment_index = 
index; }

Review Comment:
   add comment to explain the effect of _io_ctx.read_segment_index.



##########
be/src/olap/rowset/segment_v2/inverted_index_compound_directory.h:
##########
@@ -161,6 +170,8 @@ class DorisCompoundDirectory::FSIndexInput : public 
lucene::store::BufferedIndex
     const char* getObjectName() const override { return getClassName(); }
     static const char* getClassName() { return "FSIndexInput"; }
 
+    void setIdxFileCache(bool index) override { _io_ctx.read_segment_index = 
index; }

Review Comment:
   I guess it's related to something in clucene.



##########
be/src/olap/rowset/segment_v2/inverted_index_cache.cpp:
##########
@@ -43,12 +43,20 @@ InvertedIndexSearcherCache* 
InvertedIndexSearcherCache::_s_instance = nullptr;
 IndexSearcherPtr InvertedIndexSearcherCache::build_index_searcher(const 
io::FileSystemSPtr& fs,
                                                                   const 
std::string& index_dir,
                                                                   const 
std::string& file_name) {
-    DorisCompoundReader* directory =
-            new DorisCompoundReader(DorisCompoundDirectory::getDirectory(fs, 
index_dir.c_str()),
-                                    file_name.c_str(), 
config::inverted_index_read_buffer_size);
+    bool open_idx_file_cache = true;

Review Comment:
   why define a variable instead of just pass true to function?



##########
be/src/common/config.cpp:
##########
@@ -991,6 +991,7 @@ DEFINE_mInt32(inverted_index_cache_stale_sweep_time_sec, 
"600");
 DEFINE_String(inverted_index_searcher_cache_limit, "10%");
 // set `true` to enable insert searcher into cache when write inverted index 
data
 DEFINE_Bool(enable_write_index_searcher_cache, "true");
+DEFINE_Bool(enable_cooldown_preload_index_reader, "false");

Review Comment:
   enable_inverted_index_cache_on_cooldown



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to