diff --git a/pkg/local_object_storage/blobovnicza/delete.go b/pkg/local_object_storage/blobovnicza/delete.go index ab8575ad..5d678789 100644 --- a/pkg/local_object_storage/blobovnicza/delete.go +++ b/pkg/local_object_storage/blobovnicza/delete.go @@ -2,6 +2,8 @@ package blobovnicza import ( "context" + "errors" + "syscall" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" tracingPkg "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/tracing" @@ -97,5 +99,9 @@ func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, err b.itemDeleted(recordSize) } + if errors.Is(err, syscall.ENOSPC) { + err = ErrNoSpace + } + return DeleteRes{}, err } diff --git a/pkg/local_object_storage/blobovnicza/errors.go b/pkg/local_object_storage/blobovnicza/errors.go new file mode 100644 index 00000000..cff8c177 --- /dev/null +++ b/pkg/local_object_storage/blobovnicza/errors.go @@ -0,0 +1,6 @@ +package blobovnicza + +import "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" + +// ErrNoSpace returned if blobovnicza failed to perform an operation because of syscall.ENOSPC. +var ErrNoSpace = logicerr.New("no space left on device with blobovnicza") diff --git a/pkg/local_object_storage/blobovnicza/move.go b/pkg/local_object_storage/blobovnicza/move.go index 255198f6..420e22a4 100644 --- a/pkg/local_object_storage/blobovnicza/move.go +++ b/pkg/local_object_storage/blobovnicza/move.go @@ -2,7 +2,9 @@ package blobovnicza import ( "context" + "errors" "fmt" + "syscall" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -29,7 +31,7 @@ func (b *Blobovnicza) PutMoveInfo(ctx context.Context, prm MoveInfo) error { key := addressKey(prm.Address) - return b.boltDB.Update(func(tx *bbolt.Tx) error { + err := b.boltDB.Update(func(tx *bbolt.Tx) error { bucket, err := tx.CreateBucketIfNotExists(incompletedMoveBucketName) if err != nil { return err @@ -41,6 +43,11 @@ func (b *Blobovnicza) PutMoveInfo(ctx context.Context, prm MoveInfo) error { return nil }) + + if errors.Is(err, syscall.ENOSPC) { + err = ErrNoSpace + } + return err } func (b *Blobovnicza) DropMoveInfo(ctx context.Context, address oid.Address) error { @@ -53,7 +60,7 @@ func (b *Blobovnicza) DropMoveInfo(ctx context.Context, address oid.Address) err key := addressKey(address) - return b.boltDB.Update(func(tx *bbolt.Tx) error { + err := b.boltDB.Update(func(tx *bbolt.Tx) error { bucket := tx.Bucket(incompletedMoveBucketName) if bucket == nil { return nil @@ -72,6 +79,10 @@ func (b *Blobovnicza) DropMoveInfo(ctx context.Context, address oid.Address) err return nil }) + if errors.Is(err, syscall.ENOSPC) { + err = ErrNoSpace + } + return err } func (b *Blobovnicza) ListMoveInfo(ctx context.Context) ([]MoveInfo, error) { diff --git a/pkg/local_object_storage/blobovnicza/put.go b/pkg/local_object_storage/blobovnicza/put.go index 9af8a93f..ff223ba3 100644 --- a/pkg/local_object_storage/blobovnicza/put.go +++ b/pkg/local_object_storage/blobovnicza/put.go @@ -2,7 +2,9 @@ package blobovnicza import ( "context" + "errors" "fmt" + "syscall" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" @@ -95,6 +97,8 @@ func (b *Blobovnicza) Put(ctx context.Context, prm PutPrm) (PutRes, error) { }) if err == nil { b.itemAdded(recordSize) + } else if errors.Is(err, syscall.ENOSPC) { + err = ErrNoSpace } return PutRes{}, err