aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-12-09 16:17:56 +0100
committerPer Larsson <[email protected]>2021-12-09 16:17:56 +0100
commitd9dad00a33657c8759ca3551de4139136d16143b (patch)
tree2757d5fbf6b442766b4d6ea269ba2ca8cbbe537c /zenstore/gc.cpp
parentGC default off. (diff)
downloadzen-d9dad00a33657c8759ca3551de4139136d16143b.tar.xz
zen-d9dad00a33657c8759ca3551de4139136d16143b.zip
Added options for Z$ max duration and whether to collect small objects.
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp21
1 files changed, 13 insertions, 8 deletions
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<GcState>())
@@ -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);