yiguolei commented on code in PR #24029:
URL: https://github.com/apache/doris/pull/24029#discussion_r1322661904


##########
be/src/olap/rowset/segment_v2/inverted_index_cache.h:
##########
@@ -72,23 +73,18 @@ class InvertedIndexSearcherCache : public LRUCachePolicy {
 
     // Create global instance of this class.
     // "capacity" is the capacity of lru cache.
-    static void create_global_instance(size_t capacity, uint32_t num_shards = 
16);
+    static InvertedIndexSearcherCache* create_global_instance(size_t capacity,
+                                                              uint32_t 
num_shards = 16);
 
     void reset() {
         _cache.reset();
         _mem_tracker.reset();
         // Reset or clear the state of the object.
     }
 
-    static void reset_global_instance() {
-        if (_s_instance != nullptr) {
-            _s_instance->reset();
-        }
-    }
-
     // Return global instance.
     // Client should call create_global_cache before.
-    static InvertedIndexSearcherCache* instance() { return _s_instance; }
+    static InvertedIndexSearcherCache* instance() { return 
GetInvertedIndexSearcherCache(); }

Review Comment:
   remove method GetInvertedIndexSearcherCache because it is duplicated with 
InvertedIndexSearcherCache::instance



##########
be/src/olap/rowset/segment_v2/inverted_index_cache.h:
##########
@@ -223,15 +218,15 @@ class InvertedIndexQueryCache : public LRUCachePolicy {
     };
 
     // Create global instance of this class
-    static void create_global_cache(size_t capacity, uint32_t num_shards = 16) 
{
-        DCHECK(_s_instance == nullptr);
-        static InvertedIndexQueryCache instance(capacity, num_shards);
-        _s_instance = &instance;
+    static InvertedIndexQueryCache* create_global_cache(size_t capacity, 
uint32_t num_shards = 16) {
+        DCHECK(GetInvertedIndexQueryCache() == nullptr);

Review Comment:
   not need check



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