This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 9ccfd187014 [fix](invert index) Fix the timing error when opening the 
searcher #26401 (#26472)
9ccfd187014 is described below

commit 9ccfd1870143b92420bde0d1a36ba89f2180ce5a
Author: zzzxl <33418555+zzzxl1...@users.noreply.github.com>
AuthorDate: Mon Nov 6 22:53:40 2023 +0800

    [fix](invert index) Fix the timing error when opening the searcher #26401 
(#26472)
---
 be/src/olap/rowset/segment_v2/inverted_index_reader.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp 
b/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp
index 0969a7545ad..7d710d72c38 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp
@@ -281,10 +281,12 @@ Status FullTextIndexReader::query(OlapReaderStatistics* 
stats, RuntimeState* run
                     "inverted index path: {} not exist.", 
index_file_path.string());
         }
 
-        InvertedIndexCacheHandle inverted_index_cache_handle;
-        InvertedIndexSearcherCache::instance()->get_index_searcher(
-                _fs, index_dir.c_str(), index_file_name, 
&inverted_index_cache_handle, stats);
-        auto index_searcher = inverted_index_cache_handle.get_index_searcher();
+        auto get_index_search = [this, &index_dir, &index_file_name, &stats]() 
{
+            InvertedIndexCacheHandle inverted_index_cache_handle;
+            
static_cast<void>(InvertedIndexSearcherCache::instance()->get_index_searcher(
+                    _fs, index_dir.c_str(), index_file_name, 
&inverted_index_cache_handle, stats));
+            return inverted_index_cache_handle.get_index_searcher();
+        };
 
         std::unique_ptr<lucene::search::Query> query;
         std::wstring field_ws = std::wstring(column_name.begin(), 
column_name.end());
@@ -315,6 +317,8 @@ Status FullTextIndexReader::query(OlapReaderStatistics* 
stats, RuntimeState* run
             } else {
                 stats->inverted_index_query_cache_miss++;
 
+                auto index_searcher = get_index_search();
+
                 term_match_bitmap = std::make_shared<roaring::Roaring>();
 
                 Status res = Status::OK();
@@ -363,6 +367,8 @@ Status FullTextIndexReader::query(OlapReaderStatistics* 
stats, RuntimeState* run
                 } else {
                     stats->inverted_index_query_cache_miss++;
 
+                    auto index_searcher = get_index_search();
+
                     term_match_bitmap = std::make_shared<roaring::Roaring>();
                     // unique_ptr with custom deleter
                     std::unique_ptr<lucene::index::Term, void 
(*)(lucene::index::Term*)> term {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to