[#2238] neofs-node: Gracefully handle shard initialization errors

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-02-06 13:48:58 +03:00 committed by fyrchik
parent 427fe276f2
commit 59748b7ae8

View file

@ -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