[#1403] engine: Iterate all shards while seaching for an object
Some checks failed
DCO action / DCO (pull_request) Successful in 2m30s
Build / Build Components (pull_request) Successful in 3m43s
Tests and linters / Tests (pull_request) Failing after 4m10s
Tests and linters / gopls check (pull_request) Successful in 4m18s
Tests and linters / Staticcheck (pull_request) Successful in 4m24s
Tests and linters / Lint (pull_request) Successful in 4m50s
Tests and linters / Tests with -race (pull_request) Failing after 5m25s
Vulncheck / Vulncheck (pull_request) Failing after 14m28s
Tests and linters / Run gofumpt (pull_request) Failing after 14m36s
Pre-commit hooks / Pre-commit (pull_request) Failing after 14m47s

Before, when searching for an object, we iterated over shards and stopped
right after we found the object. Currently, we need to itarate over all
shards, because, when the object and its GC mark are stored separately, we
could find the object earlier than its GC mark.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-10-07 15:33:54 +03:00
parent de9f5ddad8
commit 4d79969d12

View file

@ -91,7 +91,11 @@ func (e *StorageEngine) get(ctx context.Context, prm GetPrm) (GetRes, error) {
}
if it.ObjectExpired {
return GetRes{}, errNotFound
return GetRes{}, logicerr.New(it.OutError.Error())
}
if it.OutError != nil {
return GetRes{}, it.OutError
}
if it.Object == nil {
@ -146,7 +150,10 @@ func (i *getShardIterator) tryGetWithMeta(ctx context.Context) {
res, err := sh.Get(ctx, i.ShardPrm)
if err == nil {
i.Object = res.Object()
return true
// Keep iterating over shards because the object's GC mark can be
// stored on another shard. For more information, please refer to
// https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1403.
return false
}
if res.HasMeta() {