forked from TrueCloudLab/frostfs-node
[#2238] neofs-node: Gracefully handle shard initialization errors
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
427fe276f2
commit
59748b7ae8
1 changed files with 10 additions and 5 deletions
|
@ -790,13 +790,18 @@ func initLocalStorage(c *cfg) {
|
||||||
tombstone.WithTombstoneSource(tombstoneSrc),
|
tombstone.WithTombstoneSource(tombstoneSrc),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var shardsAttached int
|
||||||
for _, optsWithMeta := range c.shardOpts() {
|
for _, optsWithMeta := range c.shardOpts() {
|
||||||
id, err := ls.AddShard(append(optsWithMeta.shOpts, shard.WithTombstoneSource(tombstoneSource))...)
|
id, err := ls.AddShard(append(optsWithMeta.shOpts, shard.WithTombstoneSource(tombstoneSource))...)
|
||||||
fatalOnErr(err)
|
if err != nil {
|
||||||
|
c.log.Error("failed to attach shard to engine", zap.Error(err))
|
||||||
c.log.Info("shard attached to engine",
|
} else {
|
||||||
zap.Stringer("id", id),
|
shardsAttached++
|
||||||
)
|
c.log.Info("shard attached to engine", zap.Stringer("id", id))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if shardsAttached == 0 {
|
||||||
|
fatalOnErr(engineconfig.ErrNoShardConfigured)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.cfgObject.cfgLocalStorage.localStorage = ls
|
c.cfgObject.cfgLocalStorage.localStorage = ls
|
||||||
|
|
Loading…
Reference in a new issue