From a3e30062dfa3446e3772ac4ba32bbdc76a200195 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 22 May 2023 13:00:24 +0300 Subject: [PATCH] [#325] node: Introduce unsafe_disable param to disable policer Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- cmd/frostfs-node/config/policer/config.go | 6 ++++++ cmd/frostfs-node/object.go | 5 +++++ internal/logs/logs.go | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/frostfs-node/config/policer/config.go b/cmd/frostfs-node/config/policer/config.go index 51e55c341..487e42be8 100644 --- a/cmd/frostfs-node/config/policer/config.go +++ b/cmd/frostfs-node/config/policer/config.go @@ -25,3 +25,9 @@ func HeadTimeout(c *config.Config) time.Duration { return HeadTimeoutDefault } + +// UnsafeDisable returns the value of "unsafe_disable" config parameter +// from "policer" section. +func UnsafeDisable(c *config.Config) bool { + return config.BoolSafe(c.Sub(subsection), "unsafe_disable") +} diff --git a/cmd/frostfs-node/object.go b/cmd/frostfs-node/object.go index 1ce330cb5..7a409da03 100644 --- a/cmd/frostfs-node/object.go +++ b/cmd/frostfs-node/object.go @@ -204,6 +204,11 @@ func initObjectService(c *cfg) { } func addPolicer(c *cfg, keyStorage *util.KeyStorage, clientConstructor *cache.ClientCache) { + if policerconfig.UnsafeDisable(c.appCfg) { + c.log.Warn(logs.FrostFSNodePolicerIsDisabled) + return + } + ls := c.cfgObject.cfgLocalStorage.localStorage pol := policer.New( diff --git a/internal/logs/logs.go b/internal/logs/logs.go index a862e745a..9b800adfc 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -477,7 +477,8 @@ const ( FrostFSNodeRemovingAllTreesForContainer = "removing all trees for container" // Debug in ../node/cmd/frostfs-node/tree.go FrostFSNodeContainerRemovalEventReceivedButTreesWerentRemoved = "container removal event received, but trees weren't removed" // Error in ../node/cmd/frostfs-node/tree.go FrostFSNodeCantListenGRPCEndpointControl = "can't listen gRPC endpoint (control)" // Error in ../node/cmd/frostfs-node/control.go - CommonApplicationStarted = "application started" // Info in ../node/cmd/frostfs-ir/main.go + FrostFSNodePolicerIsDisabled = "policer is disabled" + CommonApplicationStarted = "application started" ShardGCCollectingExpiredObjectsStarted = "collecting expired objects started" ShardGCCollectingExpiredObjectsCompleted = "collecting expired objects completed" ShardGCCollectingExpiredLocksStarted = "collecting expired locks started"