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: 1. The current logic differs from that used for the inverted index reader. 2. If we use handle_searcher_cache, it would require instantiating a new reader instance. This instance would not match the inverted index writer and would introduce additional, unnecessary code. 3. We already reuse the 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