[#1306] node: Allow tombstone_lifetime config to be loaded on the fly
All checks were successful
DCO action / DCO (pull_request) Successful in 37s
Tests and linters / Run gofumpt (pull_request) Successful in 31s
Vulncheck / Vulncheck (pull_request) Successful in 2m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m13s
Build / Build Components (pull_request) Successful in 2m25s
Tests and linters / Staticcheck (pull_request) Successful in 2m22s
Tests and linters / gopls check (pull_request) Successful in 3m4s
Tests and linters / Lint (pull_request) Successful in 3m18s
Tests and linters / Tests (pull_request) Successful in 3m42s
Tests and linters / Tests with -race (pull_request) Successful in 4m18s

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.
@ -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,
},