[#1306] node: Allow tombstone_lifetime config to be loaded on the fly
All checks were successful
DCO action / DCO (pull_request) Successful in 1m20s
Tests and linters / Run gofumpt (pull_request) Successful in 1m23s
Vulncheck / Vulncheck (pull_request) Successful in 1m36s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m15s
Build / Build Components (pull_request) Successful in 2m24s
Tests and linters / gopls check (pull_request) Successful in 2m43s
Tests and linters / Staticcheck (pull_request) Successful in 2m59s
Tests and linters / Lint (pull_request) Successful in 3m25s
Tests and linters / Tests (pull_request) Successful in 4m11s
Tests and linters / Tests with -race (pull_request) Successful in 5m59s

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 7f8a1dcf8e
commit 18a8aa75c8
2 changed files with 17 additions and 0 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)
@ -622,6 +630,7 @@ type cfgObject struct {
cfgLocalStorage cfgLocalStorage
tsLifetimeUpdated atomic.Bool
tombstoneLifetime uint64
skipSessionTokenIssuerVerification bool
@ -816,6 +825,7 @@ func initCfgObject(appCfg *config.Config) cfgObject {
return cfgObject{
pool: initObjectPool(appCfg),
tombstoneLifetime: objectconfig.TombstoneLifetime(appCfg),
tsLifetimeUpdated: atomic.Bool{},
skipSessionTokenIssuerVerification: objectconfig.Put(appCfg).SkipSessionTokenIssuerVerification(),
}
}
@ -1294,6 +1304,10 @@ func (c *cfg) reloadConfig(ctx context.Context) {
components := c.getComponents(ctx, logPrm)
// Object
c.cfgObject.tombstoneLifetime = c.ObjectCfg.tombstoneLifetime
c.cfgObject.tsLifetimeUpdated.Store(true)
// Storage Engine
var rcfg engine.ReConfiguration

View file

@ -115,6 +115,9 @@ type delNetInfo struct {
}
func (i *delNetInfo) TombstoneLifetime() (uint64, error) {
if swapped := i.cfg.cfgObject.tsLifetimeUpdated.CompareAndSwap(true, false); swapped {
i.tsLifetime = i.cfg.cfgObject.tombstoneLifetime
}
return i.tsLifetime, nil
}