[#469] cmd/neofs-node: Don't send UpdateState tx at shutdown by default

if `shutdown.offline.enabled` config option set to true, then
send netmap.UpdateState(offline) tx at the shutdown. This config
option is not set by default.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-09 13:51:01 +03:00 committed by Alex Vanin
parent a97e08cfd7
commit f6f2e4d10f
2 changed files with 8 additions and 1 deletions

View file

@ -107,6 +107,8 @@ const (
cfgReBootstrapEnabled = "bootstrap.periodic.enabled" cfgReBootstrapEnabled = "bootstrap.periodic.enabled"
cfgReBootstrapInterval = "bootstrap.periodic.interval" cfgReBootstrapInterval = "bootstrap.periodic.interval"
cfgShutdownOfflineEnabled = "shutdown.offline.enabled"
cfgObjectPutPoolSize = "pool.object.put.size" cfgObjectPutPoolSize = "pool.object.put.size"
cfgObjectGetPoolSize = "pool.object.get.size" cfgObjectGetPoolSize = "pool.object.get.size"
cfgObjectHeadPoolSize = "pool.object.head.size" cfgObjectHeadPoolSize = "pool.object.head.size"
@ -251,6 +253,8 @@ type cfgNetmap struct {
reBootstrapEnabled bool reBootstrapEnabled bool
reBootstrapInterval uint64 // in epochs reBootstrapInterval uint64 // in epochs
goOfflineEnabled bool // send `UpdateState(offline)` tx at shutdown
} }
type BootstrapType uint32 type BootstrapType uint32
@ -354,6 +358,7 @@ func initCfg(path string) *cfg {
state: state, state: state,
reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval), reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval),
reBootstrapEnabled: viperCfg.GetBool(cfgReBootstrapEnabled), reBootstrapEnabled: viperCfg.GetBool(cfgReBootstrapEnabled),
goOfflineEnabled: viperCfg.GetBool(cfgShutdownOfflineEnabled),
}, },
cfgNodeInfo: cfgNodeInfo{ cfgNodeInfo: cfgNodeInfo{
bootType: StorageNode, bootType: StorageNode,

View file

@ -85,7 +85,9 @@ func shutdown(c *cfg) {
closer() closer()
} }
if c.cfgNetmap.goOfflineEnabled {
goOffline(c) goOffline(c)
}
c.wg.Wait() c.wg.Wait()
} }