forked from TrueCloudLab/frostfs-node
[#874] engine: Revert Check object existance concurrently
This reverts commit f526f49995
.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
fd8cdb9671
commit
942d83611b
11 changed files with 35 additions and 124 deletions
|
@ -94,11 +94,6 @@ func (b *Blobovniczas) Get(ctx context.Context, prm common.GetPrm) (res common.G
|
|||
//
|
||||
// returns error if object could not be read from any blobovnicza of the same level.
|
||||
func (b *Blobovniczas) getObjectFromLevel(ctx context.Context, prm blobovnicza.GetPrm, blzPath string) (common.GetRes, error) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return common.GetRes{}, ctx.Err()
|
||||
default:
|
||||
}
|
||||
// open blobovnicza (cached inside)
|
||||
shBlz := b.getBlobovnicza(blzPath)
|
||||
blz, err := shBlz.Open()
|
||||
|
|
|
@ -230,12 +230,6 @@ func (b *Blobovniczas) iterateSortedDBPaths(ctx context.Context, addr oid.Addres
|
|||
}
|
||||
|
||||
func (b *Blobovniczas) iterateSordedDBPathsInternal(ctx context.Context, path string, addr oid.Address, f func(string) (bool, error)) (bool, error) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return false, ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
sysPath := filepath.Join(b.rootPath, path)
|
||||
entries, err := os.ReadDir(sysPath)
|
||||
if os.IsNotExist(err) && b.readOnly && path == "" { // non initialized tree in read only mode
|
||||
|
@ -258,12 +252,6 @@ func (b *Blobovniczas) iterateSordedDBPathsInternal(ctx context.Context, path st
|
|||
|
||||
if len(dbIdxs) > 0 {
|
||||
for _, dbIdx := range dbIdxs {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return false, ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
dbPath := filepath.Join(path, u64ToHexStringExt(dbIdx))
|
||||
stop, err := f(dbPath)
|
||||
if err != nil {
|
||||
|
@ -278,12 +266,6 @@ func (b *Blobovniczas) iterateSordedDBPathsInternal(ctx context.Context, path st
|
|||
if len(dirIdxs) > 0 {
|
||||
hrw.SortSliceByValue(dirIdxs, addressHash(&addr, path))
|
||||
for _, dirIdx := range dirIdxs {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return false, ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
dirPath := filepath.Join(path, u64ToHexString(dirIdx))
|
||||
stop, err := b.iterateSordedDBPathsInternal(ctx, dirPath, addr, f)
|
||||
if err != nil {
|
||||
|
|
|
@ -3,7 +3,6 @@ package blobstor
|
|||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
|
@ -58,30 +57,27 @@ func (b *BlobStor) Exists(ctx context.Context, prm common.ExistsPrm) (common.Exi
|
|||
// error | found | log the error, return true, nil
|
||||
// error | not found | return the error
|
||||
// error | error | log the first error, return the second
|
||||
var storageErrors []error
|
||||
var errors []error
|
||||
for i := range b.storage {
|
||||
res, err := b.storage[i].Storage.Exists(ctx, prm)
|
||||
if err == nil && res.Exists {
|
||||
exists = true
|
||||
return res, nil
|
||||
} else if err != nil {
|
||||
if errors.Is(err, context.Canceled) {
|
||||
return common.ExistsRes{}, err
|
||||
}
|
||||
storageErrors = append(storageErrors, err)
|
||||
errors = append(errors, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(storageErrors) == 0 {
|
||||
if len(errors) == 0 {
|
||||
return common.ExistsRes{}, nil
|
||||
}
|
||||
|
||||
for _, err := range storageErrors[:len(storageErrors)-1] {
|
||||
for _, err := range errors[:len(errors)-1] {
|
||||
b.log.Warn(logs.BlobstorErrorOccurredDuringObjectExistenceChecking,
|
||||
zap.Stringer("address", prm.Address),
|
||||
zap.String("error", err.Error()),
|
||||
zap.String("trace_id", tracingPkg.GetTraceID(ctx)))
|
||||
}
|
||||
|
||||
return common.ExistsRes{}, storageErrors[len(storageErrors)-1]
|
||||
return common.ExistsRes{}, errors[len(errors)-1]
|
||||
}
|
||||
|
|
|
@ -285,12 +285,6 @@ func (t *FSTree) Exists(ctx context.Context, prm common.ExistsPrm) (common.Exist
|
|||
))
|
||||
defer span.End()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return common.ExistsRes{}, ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
p := t.treePath(prm.Address)
|
||||
|
||||
_, err := os.Stat(p)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue