[#1403] engine: Iterate all shards while seaching for an object
Some checks failed
Vulncheck / Vulncheck (pull_request) Successful in 2m26s
Tests and linters / Staticcheck (pull_request) Successful in 2m43s
DCO action / DCO (pull_request) Successful in 2m57s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m48s
Tests and linters / Run gofumpt (pull_request) Successful in 2m37s
Build / Build Components (pull_request) Successful in 3m7s
Tests and linters / gopls check (pull_request) Successful in 4m4s
Tests and linters / Lint (pull_request) Successful in 4m34s
Tests and linters / Tests (pull_request) Failing after 4m57s
Tests and linters / Tests with -race (pull_request) Failing after 4m59s

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 5eae302461
commit 13f66540c1
No known key found for this signature in database

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() {