From 6d07b0437ccb7800652708f76a7ee84e551f43cf Mon Sep 17 00:00:00 2001 From: zousar <2936246+zousar@users.noreply.github.com> Date: Sun, 2 Mar 2025 00:15:35 -0700 Subject: Control overwrite enforcement with a config setting --- src/zenserver/config.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/zenserver/config.cpp') diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index 809092378..c8949f5fd 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -408,6 +408,7 @@ ParseConfigFile(const std::filesystem::path& Path, LuaOptions.AddOption("cache.enable"sv, ServerOptions.StructuredCacheConfig.Enabled); LuaOptions.AddOption("cache.writelog"sv, ServerOptions.StructuredCacheConfig.WriteLogEnabled, "cache-write-log"sv); LuaOptions.AddOption("cache.accesslog"sv, ServerOptions.StructuredCacheConfig.AccessLogEnabled, "cache-access-log"sv); + LuaOptions.AddOption("cache.limitoverwrites"sv, ServerOptions.StructuredCacheConfig.LimitOverwrites, "cache-limit-overwrites"sv); LuaOptions.AddOption("cache.memlayer.sizethreshold"sv, ServerOptions.StructuredCacheConfig.MemCacheSizeThreshold, @@ -859,6 +860,13 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) cxxopts::value(ServerOptions.StructuredCacheConfig.AccessLogEnabled)->default_value("false"), ""); + options.add_option("cache", + "", + "cache-limit-overwrites", + "Whether to require policy flag pattern before allowing overwrites", + cxxopts::value(ServerOptions.StructuredCacheConfig.LimitOverwrites)->default_value("false"), + ""); + options.add_option( "cache", "", -- cgit v1.2.3 From 39e750f78b0944157f0179266b7593b2e492453f Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 12 Aug 2025 17:36:41 +0200 Subject: add limitoverwrites option per bucket (#466) - Feature: Added global zenserver option `--cache-bucket-limit-overwrites` controlling Whether to require policy flag pattern before allowing overwrites or not. Default `false` = overwrites always allowed - Feature: Add per bucket cache configuration option `limitoverwrites` (Lua options file only) cache = { bucket = { -- This is the default for all namespaces limitoverwrites = true }, buckets = { -- Here you can add matching per bucket name (matches accross namespaces) iostorecompression = { limitoverwrites = false }, }, } --- src/zenserver/config.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/zenserver/config.cpp') diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index d53bedad0..23bb3ad78 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -342,6 +342,7 @@ public: Writer.WriteValue("payloadalignment", fmt::format("{}", BucketConfig.PayloadAlignment)); Writer.WriteValue("largeobjectthreshold", fmt::format("{}", BucketConfig.PayloadAlignment)); + Writer.WriteValue("limitoverwrites", fmt::format("{}", BucketConfig.LimitOverwrites)); } Writer.EndContainer(); } @@ -397,6 +398,8 @@ public: } BucketConfig.LargeObjectThreshold = LargeObjectThreshold; + BucketConfig.LimitOverwrites = Bucket.value().get_or("limitoverwrites", BucketConfig.LimitOverwrites); + Value.push_back(std::make_pair(std::move(Name), BucketConfig)); } } @@ -518,7 +521,6 @@ ParseConfigFile(const std::filesystem::path& Path, LuaOptions.AddOption("cache.enable"sv, ServerOptions.StructuredCacheConfig.Enabled); LuaOptions.AddOption("cache.writelog"sv, ServerOptions.StructuredCacheConfig.WriteLogEnabled, "cache-write-log"sv); LuaOptions.AddOption("cache.accesslog"sv, ServerOptions.StructuredCacheConfig.AccessLogEnabled, "cache-access-log"sv); - LuaOptions.AddOption("cache.limitoverwrites"sv, ServerOptions.StructuredCacheConfig.LimitOverwrites, "cache-limit-overwrites"sv); LuaOptions.AddOption("cache.memlayer.sizethreshold"sv, ServerOptions.StructuredCacheConfig.BucketConfig.MemCacheSizeThreshold, @@ -543,6 +545,9 @@ ParseConfigFile(const std::filesystem::path& Path, LuaOptions.AddOption("cache.bucket.largeobjectthreshold"sv, ServerOptions.StructuredCacheConfig.BucketConfig.LargeObjectThreshold, "cache-bucket-largeobjectthreshold"sv); + LuaOptions.AddOption("cache.bucket.limitoverwrites"sv, + ServerOptions.StructuredCacheConfig.BucketConfig.LimitOverwrites, + "cache-bucket-limit-overwrites"sv); ////// cache.upstream LuaOptions.AddOption("cache.upstream.policy"sv, ServerOptions.UpstreamCacheConfig.CachePolicy, "upstream-cache-policy"sv); @@ -1061,13 +1066,6 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) cxxopts::value(ServerOptions.StructuredCacheConfig.AccessLogEnabled)->default_value("false"), ""); - options.add_option("cache", - "", - "cache-limit-overwrites", - "Whether to require policy flag pattern before allowing overwrites", - cxxopts::value(ServerOptions.StructuredCacheConfig.LimitOverwrites)->default_value("false"), - ""); - options.add_option( "cache", "", @@ -1128,6 +1126,13 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) cxxopts::value(ServerOptions.StructuredCacheConfig.BucketConfig.MemCacheSizeThreshold)->default_value("1024"), ""); + options.add_option("cache", + "", + "cache-bucket-limit-overwrites", + "Whether to require policy flag pattern before allowing overwrites in cache bucket", + cxxopts::value(ServerOptions.StructuredCacheConfig.BucketConfig.LimitOverwrites)->default_value("false"), + ""); + options.add_option("gc", "", "gc-cache-attachment-store", -- cgit v1.2.3