[#1306] node: Allow tombstone_lifetime config to be loaded on the fly

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2024-10-01 16:09:05 +03:00
parent 9c5ddc4dfe
commit 57c31e9802
2 changed files with 17 additions and 6 deletions

View file

@ -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

View file

@ -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.
@ -425,7 +424,6 @@ func createDeleteService(c *cfg, keyStorage *util.KeyStorage, sGet *getsvc.Servi
sPut,
&delNetInfo{
State: c.cfgNetmap.state,
tsLifetime: c.cfgObject.tombstoneLifetime,
cfg: c,
},