yiguolei commented on code in PR #24029: URL: https://github.com/apache/doris/pull/24029#discussion_r1322659832
########## be/src/olap/page_cache.cpp: ########## @@ -21,16 +21,17 @@ #include <ostream> -namespace doris { - -StoragePageCache* StoragePageCache::_s_instance = nullptr; +#include "runtime/exec_env.h" -void StoragePageCache::create_global_cache(size_t capacity, int32_t index_cache_percentage, - int64_t pk_index_cache_capacity, uint32_t num_shards) { - DCHECK(_s_instance == nullptr); - static StoragePageCache instance(capacity, index_cache_percentage, pk_index_cache_capacity, - num_shards); - _s_instance = &instance; +namespace doris { +StoragePageCache* StoragePageCache::create_global_cache(size_t capacity, + int32_t index_cache_percentage, + int64_t pk_index_cache_capacity, + uint32_t num_shards) { + DCHECK(GetGlobalStoragePageCache() == nullptr); Review Comment: do not add this dcheck, because we may use this method in unit test, we need call create global cache multi times. -- 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