[opt](cache) Support segment cache dynamic opening and closing (#23659)

Dynamically modify the config to clear the cache, each time the disable cache will only be cleared once.
TODO, Support page cache and other caches.

curl -X POST http://xxxx:8040/api/update_config?disable_segment_cache=true
This commit is contained in:
Xinyi Zou
2023-08-31 18:48:26 +08:00
committed by GitHub
parent 3a2c0d16f7
commit f1e43fcaa4
17 changed files with 142 additions and 40 deletions

View File

@ -43,7 +43,16 @@ int64_t CacheManager::for_each_cache_prune_stale(RuntimeProfile* profile) {
int64_t CacheManager::for_each_cache_prune_all(RuntimeProfile* profile) {
return for_each_cache_prune_stale_wrap(
[](CachePolicy* cache_policy) { cache_policy->prune_all(); }, profile);
[](CachePolicy* cache_policy) { cache_policy->prune_all(false); }, profile);
}
void CacheManager::clear_once(CachePolicy::CacheType type) {
std::lock_guard<std::mutex> l(_caches_lock);
for (auto cache_policy : _caches) {
if (cache_policy->type() == type) {
cache_policy->prune_all(true); // will print log
}
}
}
} // namespace doris