forked from TrueCloudLab/frostfs-node
[#937] node: Init node state before gRPC server start
Fix panic when node processes RPC requests before state initialization is finished. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
99f9f8dd08
commit
208d150500
2 changed files with 10 additions and 3 deletions
|
@ -3,6 +3,9 @@ Changelog for NeoFS Node
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Storage Node handles requests before its initialization is finished (#934)
|
||||
|
||||
## [0.26.0] - 2021-10-19 - Udo (우도, 牛島)
|
||||
|
||||
NeoFS API v2.10 support
|
||||
|
|
|
@ -90,6 +90,8 @@ func initNetmapService(c *cfg) {
|
|||
initMorphComponents(c)
|
||||
}
|
||||
|
||||
initNetmapState(c)
|
||||
|
||||
server := netmapTransportGRPC.New(
|
||||
netmapService.NewSignService(
|
||||
&c.key.PrivateKey,
|
||||
|
@ -162,9 +164,9 @@ func initNetmapService(c *cfg) {
|
|||
}
|
||||
}
|
||||
|
||||
// bootstrapNode adds current node to the Network map.
|
||||
// Must be called after initNetmapService.
|
||||
func bootstrapNode(c *cfg) {
|
||||
initState(c)
|
||||
|
||||
if c.needBootstrap() {
|
||||
err := c.bootstrap()
|
||||
fatalOnErrDetails("bootstrap error", err)
|
||||
|
@ -191,7 +193,9 @@ func setNetmapNotificationParser(c *cfg, sTyp string, p event.NotificationParser
|
|||
c.cfgNetmap.parsers[typ] = p
|
||||
}
|
||||
|
||||
func initState(c *cfg) {
|
||||
// initNetmapState inits current Network map state.
|
||||
// Must be called after Morph components initialization.
|
||||
func initNetmapState(c *cfg) {
|
||||
epoch, err := c.cfgNetmap.wrapper.Epoch()
|
||||
fatalOnErrDetails("could not initialize current epoch number", err)
|
||||
|
||||
|
|
Loading…
Reference in a new issue