forked from TrueCloudLab/frostfs-node
[#490] cmd/neofs-node: Do not send rebootstrap after node went offline
Control service turns storage node to online and offline modes. We can't reuse `cfgNetmap.reBootstrapEnabled` because it represents configuration value while control service manages state in runtime. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
de74fcc38f
commit
e9b3488aab
2 changed files with 10 additions and 1 deletions
|
@ -75,6 +75,10 @@ func initNetmapService(c *cfg) {
|
|||
|
||||
if c.cfgNetmap.reBootstrapEnabled {
|
||||
addNewEpochAsyncNotificationHandler(c, func(ev event.Event) {
|
||||
if c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
||||
return
|
||||
}
|
||||
|
||||
n := ev.(netmapEvent.NewEpoch).EpochNumber()
|
||||
|
||||
if n%c.cfgNetmap.reBootstrapInterval == 0 {
|
||||
|
@ -202,6 +206,7 @@ func goOffline(c *cfg) {
|
|||
|
||||
func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error {
|
||||
if st == control.NetmapStatus_ONLINE {
|
||||
c.cfgNetmap.reBoostrapTurnedOff.Store(false)
|
||||
return c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo())
|
||||
}
|
||||
|
||||
|
@ -211,6 +216,8 @@ func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error {
|
|||
apiState = netmapSDK.NodeStateOffline
|
||||
}
|
||||
|
||||
c.cfgNetmap.reBoostrapTurnedOff.Store(true)
|
||||
|
||||
return c.cfgNetmap.wrapper.UpdatePeerState(
|
||||
crypto.MarshalPublicKey(&c.key.PublicKey),
|
||||
apiState,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue