From e27a5da5dae33f958a4b809a9e20a0af33c24f90 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 25 Sep 2024 10:21:53 +0200 Subject: Add `gc-attachment-passes` option to zenserver (#167) Added option `gc-attachment-passes` to zenserver Cleaned up GCv2 start and stop logs and added identifier to easily find matching start and end of a GC pass in log file Fixed project store not properly sorting references found during lock phase --- src/zenserver/config.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/zenserver/config.cpp') diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index 6c2bf40d8..2023a9d51 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -165,6 +165,11 @@ ValidateOptions(ZenServerOptions& ServerOptions) { throw zen::OptionParseException("Dedicated server can not be used with forced local server address"); } + if (ServerOptions.GcConfig.AttachmentPassCount > ZenGcConfig::GcMaxAttachmentPassCount) + { + throw zen::OptionParseException( + fmt::format("GC attachment pass count can not be larger than {}", ZenGcConfig::GcMaxAttachmentPassCount)); + } } UpstreamCachePolicy @@ -524,6 +529,7 @@ ParseConfigFile(const std::filesystem::path& Path, LuaOptions.AddOption("gc.projectstore.attachment.store"sv, ServerOptions.ProjectStoreConfig.StoreAttachmentMetaData, "gc-projectstore-attachment-store"); + LuaOptions.AddOption("gc.attachment.passes"sv, ServerOptions.GcConfig.AttachmentPassCount, "gc-attachment-passes"sv); ////// gc LuaOptions.AddOption("gc.cache.maxdurationseconds"sv, ServerOptions.GcConfig.Cache.MaxDurationSeconds, "gc-cache-duration-seconds"sv); @@ -1015,6 +1021,14 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) cxxopts::value(ServerOptions.GcConfig.SingleThreaded)->default_value("false"), ""); + options.add_option("gc", + "", + "gc-attachment-passes", + "Limit the range of unreferenced attachments included in GC check by breaking it into passes. Default is one pass " + "which includes all the attachments.", + cxxopts::value(ServerOptions.GcConfig.AttachmentPassCount)->default_value("1"), + ""); + options.add_option("objectstore", "", "objectstore-enabled", -- cgit v1.2.3