forked from TrueCloudLab/frostfs-node
[#1166] blobovnicza: Return NoSpaceLeft error instead of syscall.ENOSPC
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
a0c588263b
commit
e7d479f4c2
4 changed files with 29 additions and 2 deletions
|
@ -2,6 +2,8 @@ package blobovnicza
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||||
tracingPkg "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/tracing"
|
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)
|
b.itemDeleted(recordSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, syscall.ENOSPC) {
|
||||||
|
err = ErrNoSpace
|
||||||
|
}
|
||||||
|
|
||||||
return DeleteRes{}, err
|
return DeleteRes{}, err
|
||||||
}
|
}
|
||||||
|
|
6
pkg/local_object_storage/blobovnicza/errors.go
Normal file
6
pkg/local_object_storage/blobovnicza/errors.go
Normal file
|
@ -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")
|
|
@ -2,7 +2,9 @@ package blobovnicza
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
||||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
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)
|
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)
|
bucket, err := tx.CreateBucketIfNotExists(incompletedMoveBucketName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -41,6 +43,11 @@ func (b *Blobovnicza) PutMoveInfo(ctx context.Context, prm MoveInfo) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if errors.Is(err, syscall.ENOSPC) {
|
||||||
|
err = ErrNoSpace
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Blobovnicza) DropMoveInfo(ctx context.Context, address oid.Address) error {
|
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)
|
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)
|
bucket := tx.Bucket(incompletedMoveBucketName)
|
||||||
if bucket == nil {
|
if bucket == nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -72,6 +79,10 @@ func (b *Blobovnicza) DropMoveInfo(ctx context.Context, address oid.Address) err
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
if errors.Is(err, syscall.ENOSPC) {
|
||||||
|
err = ErrNoSpace
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Blobovnicza) ListMoveInfo(ctx context.Context) ([]MoveInfo, error) {
|
func (b *Blobovnicza) ListMoveInfo(ctx context.Context) ([]MoveInfo, error) {
|
||||||
|
|
|
@ -2,7 +2,9 @@ package blobovnicza
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
"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 {
|
if err == nil {
|
||||||
b.itemAdded(recordSize)
|
b.itemAdded(recordSize)
|
||||||
|
} else if errors.Is(err, syscall.ENOSPC) {
|
||||||
|
err = ErrNoSpace
|
||||||
}
|
}
|
||||||
|
|
||||||
return PutRes{}, err
|
return PutRes{}, err
|
||||||
|
|
Loading…
Reference in a new issue