[#1403] engine: Iterate all shards while seaching for an object
Some checks failed
DCO action / DCO (pull_request) Successful in 1m31s
Vulncheck / Vulncheck (pull_request) Successful in 2m14s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m24s
Build / Build Components (pull_request) Successful in 2m28s
Tests and linters / Lint (pull_request) Successful in 2m59s
Tests and linters / Run gofumpt (pull_request) Successful in 2m55s
Tests and linters / gopls check (pull_request) Successful in 3m13s
Tests and linters / Tests (pull_request) Failing after 3m30s
Tests and linters / Staticcheck (pull_request) Successful in 3m35s
Tests and linters / Tests with -race (pull_request) Failing after 5m5s

Before, when searching for an object, we iterated over shards and stopped
right after we found the object. Currently, we need to iterate 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 6ccac0a476
commit 2dc934839a
No known key found for this signature in database

View file

@ -94,6 +94,10 @@ func (e *StorageEngine) get(ctx context.Context, prm GetPrm) (GetRes, error) {
return GetRes{}, errNotFound
}
if client.IsErrObjectAlreadyRemoved(it.OutError) {
return GetRes{}, it.OutError
}
if it.Object == nil {
if !it.HasDegraded && it.ShardWithMeta.Shard == nil || !client.IsErrObjectNotFound(it.OutError) {
return GetRes{}, it.OutError
@ -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() {