From a4ff07d68eeae66c008bfac28cb87c94a92cf257 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 16 May 2023 12:23:42 +0200 Subject: Add `--gc-projectstore-duration-seconds` option (#281) * Add `--gc-projectstore-duration-seconds` option * Cleanup lua gc options parsing * Remove dead configuration values * changelog --- src/zenserver/config.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/zenserver/config.cpp') diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index 5b635b89d..0e7aac079 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -504,6 +504,13 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) cxxopts::value(ServerOptions.GcConfig.Cache.MaxDurationSeconds)->default_value("1209600"), ""); + options.add_option("gc", + "", + "gc-projectstore-duration-seconds", + "Max duration in seconds before project store entries get evicted. Default set to 1209600 (2 weeks)", + cxxopts::value(ServerOptions.GcConfig.ProjectStore.MaxDurationSeconds)->default_value("1209600"), + ""); + options.add_option("gc", "", "disk-reserve-size", @@ -522,14 +529,14 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) "", "gc-low-diskspace-threshold", "Minimum free space on disk to allow writes to disk. Default set to 268435456 (256 Mb). Set to zero to disable.", - cxxopts::value(ServerOptions.GcConfig.Cache.MinimumFreeDiskSpaceToAllowWrites)->default_value("268435456"), + cxxopts::value(ServerOptions.GcConfig.MinimumFreeDiskSpaceToAllowWrites)->default_value("268435456"), ""); options.add_option("gc", "", "gc-disksize-softlimit", "Garbage collection disk usage soft limit. Default set to 0 (Off).", - cxxopts::value(ServerOptions.GcConfig.Cache.DiskSizeSoftLimit)->default_value("0"), + cxxopts::value(ServerOptions.GcConfig.DiskSizeSoftLimit)->default_value("0"), ""); options.add_option("objectstore", @@ -878,21 +885,16 @@ ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptio ServerOptions.GcConfig.MonitorIntervalSeconds = GcConfig.value().get_or("monitorintervalseconds", 30); ServerOptions.GcConfig.IntervalSeconds = GcConfig.value().get_or("intervalseconds", 0); ServerOptions.GcConfig.DiskReserveSize = GcConfig.value().get_or("diskreservesize", uint64_t(1u << 28)); + ServerOptions.GcConfig.DiskSizeSoftLimit = GcConfig.value().get_or("disksizesoftlimit", 0); ServerOptions.GcConfig.MinimumFreeDiskSpaceToAllowWrites = GcConfig.value().get_or("lowdiskspacethreshold", 0); if (sol::optional CacheGcConfig = GcConfig.value()["cache"]) { ServerOptions.GcConfig.Cache.MaxDurationSeconds = CacheGcConfig.value().get_or("maxdurationseconds", int32_t(0)); - ServerOptions.GcConfig.Cache.DiskSizeLimit = CacheGcConfig.value().get_or("disksizelimit", ~uint64_t(0)); - ServerOptions.GcConfig.Cache.MemorySizeLimit = CacheGcConfig.value().get_or("memorysizelimit", ~uint64_t(0)); - ServerOptions.GcConfig.Cache.DiskSizeSoftLimit = CacheGcConfig.value().get_or("disksizesoftlimit", 0); } - - if (sol::optional CasGcConfig = GcConfig.value()["cas"]) + if (sol::optional CacheGcConfig = GcConfig.value()["projectstore"]) { - ServerOptions.GcConfig.Cas.LargeStrategySizeLimit = CasGcConfig.value().get_or("largestrategysizelimit", ~uint64_t(0)); - ServerOptions.GcConfig.Cas.SmallStrategySizeLimit = CasGcConfig.value().get_or("smallstrategysizelimit", ~uint64_t(0)); - ServerOptions.GcConfig.Cas.TinyStrategySizeLimit = CasGcConfig.value().get_or("tinystrategysizelimit", ~uint64_t(0)); + ServerOptions.GcConfig.ProjectStore.MaxDurationSeconds = CacheGcConfig.value().get_or("maxdurationseconds", int32_t(0)); } } -- cgit v1.2.3