You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/08/03 05:20:12 UTC
[doris] branch branch-2.0 updated: [fix][branch-2.0](memory) fix cache regular clean (#22540)
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 280f612548 [fix][branch-2.0](memory) fix cache regular clean (#22540)
280f612548 is described below
commit 280f61254836abb4db7441ae4a75b7bcaefaefde
Author: Xinyi Zou <zo...@gmail.com>
AuthorDate: Thu Aug 3 13:20:05 2023 +0800
[fix][branch-2.0](memory) fix cache regular clean (#22540)
---
be/src/common/config.cpp | 2 +-
be/src/olap/page_cache.cpp | 2 ++
be/src/olap/page_cache.h | 7 ++++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index b38061a3fc..d9940e662d 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -264,7 +264,7 @@ DEFINE_mInt64(memory_limitation_per_thread_for_schema_change_bytes, "2147483648"
DEFINE_mInt64(memory_limitation_per_thread_for_storage_migration_bytes, "100000000");
// the clean interval of file descriptor cache and segment cache
-DEFINE_mInt32(cache_clean_interval, "60");
+DEFINE_mInt32(cache_clean_interval, "10");
// the clean interval of tablet lookup cache
DEFINE_mInt32(tablet_lookup_cache_clean_interval, "30");
DEFINE_mInt32(disk_stat_monitor_interval, "5");
diff --git a/be/src/olap/page_cache.cpp b/be/src/olap/page_cache.cpp
index 47a2379576..57049bdc6d 100644
--- a/be/src/olap/page_cache.cpp
+++ b/be/src/olap/page_cache.cpp
@@ -62,6 +62,7 @@ bool StoragePageCache::lookup(const CacheKey& key, PageCacheHandle* handle,
return false;
}
*handle = PageCacheHandle(cache, lru_handle);
+ handle->update_last_visit_time();
return true;
}
@@ -80,6 +81,7 @@ void StoragePageCache::insert(const CacheKey& key, DataPage* data, PageCacheHand
auto cache = _get_page_cache(page_type);
auto lru_handle = cache->insert(key.encode(), data, data->capacity(), deleter, priority);
*handle = PageCacheHandle(cache, lru_handle);
+ handle->update_last_visit_time();
}
} // namespace doris
diff --git a/be/src/olap/page_cache.h b/be/src/olap/page_cache.h
index b065d52d0e..3f76546013 100644
--- a/be/src/olap/page_cache.h
+++ b/be/src/olap/page_cache.h
@@ -37,7 +37,7 @@ namespace doris {
class PageCacheHandle;
template <typename TAllocator>
-class PageBase : private TAllocator, LRUCacheValueBase {
+class PageBase : private TAllocator, public LRUCacheValueBase {
public:
PageBase() : _data(nullptr), _size(0), _capacity(0) {}
@@ -229,6 +229,11 @@ public:
return Slice(cache_value->data(), cache_value->size());
}
+ void update_last_visit_time() {
+ DataPage* cache_value = (DataPage*)_cache->value(_handle);
+ cache_value->last_visit_time = UnixMillis();
+ }
+
private:
Cache* _cache = nullptr;
Cache::Handle* _handle = nullptr;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org