forked from TrueCloudLab/frostfs-node
[#1922] neofs-node: Allow to go online after maintenance
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
1980ed968a
commit
0d14ef69f0
3 changed files with 8 additions and 5 deletions
|
@ -9,6 +9,7 @@ Changelog for NeoFS Node
|
||||||
### Changed
|
### Changed
|
||||||
### Fixed
|
### Fixed
|
||||||
- `writecache.max_object_size` is now correctly handled (#1925)
|
- `writecache.max_object_size` is now correctly handled (#1925)
|
||||||
|
- Correctly handle setting ONLINE netmap status after maintenance (#1922)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
### Updated
|
### Updated
|
||||||
|
|
|
@ -848,11 +848,13 @@ func (c *cfg) handleLocalNodeInfo(ni *netmap.NodeInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bootstrap sets local node's netmap status to "online".
|
// bootstrap sets local node's netmap status to "online".
|
||||||
func (c *cfg) bootstrap() error {
|
// If current netmap status is MAINTENANCE and this function wasn't called thorough a control service,
|
||||||
|
// the status is untouched.
|
||||||
|
func (c *cfg) bootstrap(manual bool) error {
|
||||||
ni := c.cfgNodeInfo.localInfo
|
ni := c.cfgNodeInfo.localInfo
|
||||||
|
|
||||||
// switch to online except when under maintenance
|
// switch to online except when under maintenance
|
||||||
if st := c.cfgNetmap.state.controlNetmapStatus(); st == control.NetmapStatus_MAINTENANCE {
|
if st := c.cfgNetmap.state.controlNetmapStatus(); st == control.NetmapStatus_MAINTENANCE && !manual {
|
||||||
ni.SetMaintenance()
|
ni.SetMaintenance()
|
||||||
|
|
||||||
c.log.Info("bootstrap with untouched node state",
|
c.log.Info("bootstrap with untouched node state",
|
||||||
|
|
|
@ -179,7 +179,7 @@ func initNetmapService(c *cfg) {
|
||||||
const reBootstrapInterval = 2
|
const reBootstrapInterval = 2
|
||||||
|
|
||||||
if (n-c.cfgNetmap.startEpoch)%reBootstrapInterval == 0 {
|
if (n-c.cfgNetmap.startEpoch)%reBootstrapInterval == 0 {
|
||||||
err := c.bootstrap()
|
err := c.bootstrap(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log.Warn("can't send re-bootstrap tx", zap.Error(err))
|
c.log.Warn("can't send re-bootstrap tx", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ func readSubnetCfg(c *cfg) {
|
||||||
// Must be called after initNetmapService.
|
// Must be called after initNetmapService.
|
||||||
func bootstrapNode(c *cfg) {
|
func bootstrapNode(c *cfg) {
|
||||||
if c.needBootstrap() {
|
if c.needBootstrap() {
|
||||||
err := c.bootstrap()
|
err := c.bootstrap(false)
|
||||||
fatalOnErrDetails("bootstrap error", err)
|
fatalOnErrDetails("bootstrap error", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error {
|
||||||
|
|
||||||
if st == control.NetmapStatus_ONLINE {
|
if st == control.NetmapStatus_ONLINE {
|
||||||
c.cfgNetmap.reBoostrapTurnedOff.Store(false)
|
c.cfgNetmap.reBoostrapTurnedOff.Store(false)
|
||||||
return c.bootstrap()
|
return c.bootstrap(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.cfgNetmap.reBoostrapTurnedOff.Store(true)
|
c.cfgNetmap.reBoostrapTurnedOff.Store(true)
|
||||||
|
|
Loading…
Reference in a new issue