airborne12 commented on code in PR #43992:
URL: https://github.com/apache/doris/pull/43992#discussion_r1942395576


##########
be/src/olap/rowset/segment_v2/inverted_index_file_writer.cpp:
##########
@@ -120,6 +123,62 @@ int64_t InvertedIndexFileWriter::headerLength() {
     return header_size;
 }
 
+Status InvertedIndexFileWriter::add_into_searcher_cache() {
+    auto inverted_index_file_reader =
+            std::make_unique<InvertedIndexFileReader>(_fs, _index_path_prefix, 
_storage_format);
+    auto st = inverted_index_file_reader->init();
+    if (!st.ok()) {
+        if (dynamic_cast<io::StreamSinkFileWriter*>(_idx_v2_writer.get()) != 
nullptr) {
+            //StreamSinkFileWriter not found file is normal.
+            return Status::OK();
+        }
+        LOG(WARNING) << "InvertedIndexFileWriter::add_into_searcher_cache for "
+                     << _index_path_prefix << ", error " << st.msg();
+        return st;
+    }
+    for (const auto& entry : _indices_dirs) {
+        auto index_meta = entry.first;
+        auto dir =

Review Comment:
   First, the logic here is not the same with reader.
   Second, if we use handle_searcher_cache, we must new reader instance which 
is not matched with writer and need a lot code blocks which is not needed in 
writer.
   Last, we already reuse static function 
InvertedIndexReader::create_index_searcher.



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