From 57c31e9802ad19b8d64388315cd53a05515e353e Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Tue, 1 Oct 2024 16:09:05 +0300 Subject: [PATCH] [#1306] node: Allow tombstone_lifetime config to be loaded on the fly Signed-off-by: Ekaterina Lebedeva --- cmd/frostfs-node/config.go | 17 +++++++++++++++-- cmd/frostfs-node/object.go | 6 ++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 58a96879f..4ad9ec6c6 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -105,6 +105,10 @@ type applicationConfiguration struct { timestamp bool } + ObjectCfg struct { + tombstoneLifetime uint64 + } + EngineCfg struct { errorThreshold uint32 shardPoolSize uint32 @@ -223,6 +227,10 @@ func (a *applicationConfiguration) readConfig(c *config.Config) error { a.LoggerCfg.destination = loggerconfig.Destination(c) a.LoggerCfg.timestamp = loggerconfig.Timestamp(c) + // Object + + a.ObjectCfg.tombstoneLifetime = objectconfig.TombstoneLifetime(c) + // Storage Engine a.EngineCfg.errorThreshold = engineconfig.ShardErrorThreshold(c) @@ -624,7 +632,7 @@ type cfgObject struct { cfgLocalStorage cfgLocalStorage - tombstoneLifetime uint64 + tombstoneLifetime *atomic.Uint64 skipSessionTokenIssuerVerification bool } @@ -815,9 +823,11 @@ func initCfgGRPC() cfgGRPC { } func initCfgObject(appCfg *config.Config) cfgObject { + var tsLifetime atomic.Uint64 + tsLifetime.Store(objectconfig.TombstoneLifetime(appCfg)) return cfgObject{ pool: initObjectPool(appCfg), - tombstoneLifetime: objectconfig.TombstoneLifetime(appCfg), + tombstoneLifetime: &tsLifetime, skipSessionTokenIssuerVerification: objectconfig.Put(appCfg).SkipSessionTokenIssuerVerification(), } } @@ -1296,6 +1306,9 @@ func (c *cfg) reloadConfig(ctx context.Context) { components := c.getComponents(ctx, logPrm) + // Object + c.cfgObject.tombstoneLifetime.Store(c.ObjectCfg.tombstoneLifetime) + // Storage Engine var rcfg engine.ReConfiguration diff --git a/cmd/frostfs-node/object.go b/cmd/frostfs-node/object.go index 9d4e35ca8..47649c88b 100644 --- a/cmd/frostfs-node/object.go +++ b/cmd/frostfs-node/object.go @@ -109,13 +109,12 @@ func (s *objectSvc) GetRangeHash(ctx context.Context, req *object.GetRangeHashRe type delNetInfo struct { netmap.State - tsLifetime uint64 cfg *cfg } func (i *delNetInfo) TombstoneLifetime() (uint64, error) { - return i.tsLifetime, nil + return i.cfg.cfgObject.tombstoneLifetime.Load(), nil } // returns node owner ID calculated from configured private key. @@ -424,8 +423,7 @@ func createDeleteService(c *cfg, keyStorage *util.KeyStorage, sGet *getsvc.Servi sSearch, sPut, &delNetInfo{ - State: c.cfgNetmap.state, - tsLifetime: c.cfgObject.tombstoneLifetime, + State: c.cfgNetmap.state, cfg: c, },