[#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
|
@ -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]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue