From e21eedee06255a2dbf983ae0ba339172d7cf08bb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Feb 2022 01:19:50 +0300 Subject: [PATCH] [#1175] shard: Return status error on Inhume of locked object Make `Shard.Inhume` to forward `apistatus.ObjectLocked` returned by underlying metabase. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/shard/inhume.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/local_object_storage/shard/inhume.go b/pkg/local_object_storage/shard/inhume.go index e0db364db..e38c564ae 100644 --- a/pkg/local_object_storage/shard/inhume.go +++ b/pkg/local_object_storage/shard/inhume.go @@ -1,6 +1,8 @@ package shard import ( + "fmt" + meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address" "go.uber.org/zap" @@ -44,6 +46,9 @@ func (p *InhumePrm) MarkAsGarbage(addr ...*addressSDK.Address) *InhumePrm { // Inhume calls metabase. Inhume method to mark object as removed. It won't be // removed physically from blobStor and metabase until `Delete` operation. // +// Allows inhuming non-locked objects only. Returns apistatus.ObjectLocked +// if at least one object is locked. +// // Returns ErrReadOnlyMode error if shard is in "read-only" mode. func (s *Shard) Inhume(prm *InhumePrm) (*InhumeRes, error) { if s.GetMode() == ModeReadOnly { @@ -69,6 +74,8 @@ func (s *Shard) Inhume(prm *InhumePrm) (*InhumeRes, error) { s.log.Debug("could not mark object to delete in metabase", zap.String("error", err.Error()), ) + + return nil, fmt.Errorf("metabase inhume: %w", err) } return new(InhumeRes), nil