From d9dad00a33657c8759ca3551de4139136d16143b Mon Sep 17 00:00:00 2001 From: Per Larsson Date: Thu, 9 Dec 2021 16:17:56 +0100 Subject: Added options for Z$ max duration and whether to collect small objects. --- zenstore/gc.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'zenstore/gc.cpp') diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp index 5aff20e7a..bf04543b5 100644 --- a/zenstore/gc.cpp +++ b/zenstore/gc.cpp @@ -50,9 +50,9 @@ struct GcContext::GcState CasChunkSet m_CasChunks; CasChunkSet m_CidChunks; GcClock::TimePoint m_GcTime; - GcClock::Duration m_MaxCacheDuration = std::chrono::hours(24); - bool m_DeletionMode = true; - bool m_ContainerGcEnabled = false; + GcClock::Duration m_MaxCacheDuration = std::chrono::hours(24); + bool m_DeletionMode = true; + bool m_CollectSmallObjects = false; }; GcContext::GcContext(GcClock::TimePoint Time) : m_State(std::make_unique()) @@ -107,15 +107,15 @@ GcContext::SetDeletionMode(bool NewState) } bool -GcContext::IsContainerGcEnabled() const +GcContext::CollectSmallObjects() const { - return m_State->m_ContainerGcEnabled; + return m_State->m_CollectSmallObjects; } void -GcContext::SetContainerGcEnabled(bool NewState) +GcContext::CollectSmallObjects(bool NewState) { - m_State->m_ContainerGcEnabled = NewState; + m_State->m_CollectSmallObjects = NewState; } GcClock::TimePoint @@ -346,7 +346,12 @@ GcScheduler::SchedulerThread() GcContext GcCtx; GcCtx.SetDeletionMode(true); - GcCtx.SetContainerGcEnabled(true); + GcCtx.CollectSmallObjects(m_Config.CollectSmallObjects); + GcCtx.MaxCacheDuration(m_Config.MaxCacheDuration); + + ZEN_DEBUG("collecting small objects {}, max cache duration {}s", + m_Config.CollectSmallObjects ? "YES"sv : "NO"sv, + m_Config.MaxCacheDuration.count()); m_CasGc.CollectGarbage(GcCtx); -- cgit v1.2.3